Questions tagged [nsmutabledictionary]

NSMutableDictionary is the mutable version of NSDictionary.

Like NSDictionary (), it is a subclass of NSObject (), that allows you to have a collection of objects, but instead of having them stored in an array retrievable by their index, they are stored as a key-value pair. Each object stored in an NSDictionary can be retrieved by a unique key assigned to it. Keys have to be unique and can be any object as long as they adopt the NSCopying protocol – they are usually an instance of NSString ().

Neither a key nor the object paired with it can be nil, however, you may use NSNull for storing null objects.

If two objects are stored with the same key, the first one is released, and the last one is stored.

When using key-value coding, the key must be a string. When using key-object coding, the key is copied using copyWithZone: and it must conform to the NSCopying protocol. This object is retained, rather than copy.

NSMutableDictionary gives you the ability to modify this set of key-object paired collection without having to empty it and refill it again as a whole set. The following methods are for this purpose:

Adding Entries to a Mutable Dictionary

– setObject:forKey: 
– setValue:forKey: 
– addEntriesFromDictionary: 
– setDictionary:

Removing Entries From a Mutable Dictionary

– removeObjectForKey: 
– removeAllObjects 
– removeObjectsForKeys:

Resources:

1306 questions
-2
votes
4 answers

Issue : Convert an Object to json in iOS

I have one main entity class with name "Store" like : Store.h :- #import #import "SignIn.h" @interface Store : NSObject @property (nonatomic, retain) NSString *storeId; @property (nonatomic, retain) NSString…
Anand Gautam
  • 2,541
  • 3
  • 34
  • 70
-2
votes
1 answer

Add Values between 2 NSMutableDictionary

I need add values from 2 NSMutableDictionary here is my example but not working =( NSMutableDictionary *coord = [[NSMutableDictionary alloc] init]; NSMutableDictionary *data = [[NSMutableDictionary alloc] init]; data = [dao…
Fabio
  • 1,913
  • 5
  • 29
  • 53
-2
votes
1 answer

How to access the values of NSMutableDictionary in Objective-C?

This is my code NSMutableArray *responseArray = [responseString objectFromJSONString]; I want to do like this to get values: NSMutableDictionary *responseDict = [responseArray objectAtIndex:<#(NSUInteger)#>]; I want to add NSMutalbeArray to Dict…
-2
votes
4 answers

Sorting NSMutableDictionary of ints in iOS

I am just wondering if it is possible to sort a dictionary of integers in iOS? Looking at previous examples/questions it seems that most people are sorting arrays of ints or arrays of dictionaries (containing ints). However, lets say I have a…
Da49
  • 107
  • 2
  • 10
-2
votes
4 answers

Merging two mutable dictionaries in an NSMutableArray

I have an array with data from server. I can't change the server's response. ({ ObservationMapId = 13; "Observation_Type" = Results; actionItem = "Tesing action"; followupdate = "February 14, 2013"; …
srividya
  • 419
  • 6
  • 16
-2
votes
2 answers

NSMutableDictionary issue

In my application I take input from user and store it in NSMutableDictionary and Fetch result successfully. But I am little confused about the output print on console. It's not in an order. What is reason behind this output? Thanks I use the…
QueueOverFlow
  • 1,336
  • 5
  • 27
  • 48
-3
votes
1 answer

How to add NSMutableDictionary to Array

Firstly I am accessing an API service with help of Alamofire. After success I display they array in an tableView. Now I want to add NSMutableDictionary to that response array for selectedIndexPath only.
-3
votes
1 answer

Dynamically sort NSMutableArray data into NSDictionary alphabetically

Unfortunatly I dont currently have internet on my laptop so I will have to describe my code, I have a mutable array of alphabetically sorted song titles. I have a uitableview that is currently displaying these however I want to have section heads…
Jobalisk
  • 728
  • 1
  • 6
  • 17
-3
votes
2 answers

How to take values from a NSMutableDictionary

I am trying to take value from an NSMutableDictionary I can't take it because its multi dimensional { "seleted_days" = ( TUE, WED ); timings = ( ( ), ( ), …
SHINTO JOSEPH
  • 377
  • 4
  • 17
-3
votes
2 answers

How to export .JSON file using NSMutableDictionary?

I have NSMutableDictionary inside this values are present like this { 0 = { imageangle = "0.09630692"; imageheight = "129.0245"; imagepath =…
Kishore Kumar
  • 4,265
  • 3
  • 26
  • 47
-3
votes
1 answer

Changing the structure of an NSDictionary

I have an array containing dictionaries like this: This is my code: where the keys are objs are "ABC", "SKY" and the keys are "T-4112-561-560.ts", "T-4112-561-561.ts" array = [NSMutableArray array]; [array addObjectsFromArray: keys]; …
joe
  • 13
  • 1
  • 5
-3
votes
2 answers

App crashing when trying to setValue in NSMuableDictionary

My app is crashing when I try to set value in NSMutableDictionary. Here is the code below which demostrate the crash, I am not able to find out any crash log also in the console. NSArray *b =[[a objectAtIndex:1]…
Gaurav Parmar
  • 447
  • 2
  • 11
-3
votes
1 answer

App crash using setValue:forKey

I have a mutable array "myArray" like: { IdPregunta = 1; Respuestas = ( { IdResp = 1; Valor = 1; }, { IdResp = 2; Valor = 0; } ); }, as…
Dome
  • 97
  • 8
-3
votes
2 answers

Objective C Acessing NSMutableDictionay inside NSMutableDictionary

I am a newcomer to objective C and I have serious problems in accessing NSMutableDictionarys. I have two objects (Network and Beacon), and I want to create a NSMutableDictionary of Networks with a NSMutableDictionary of Beacons…
Kepa Santos
  • 557
  • 7
  • 21
-3
votes
1 answer

NSMutableArray accessing NSMutableDictionary

I read in 4 fields from a database and store them in NSMutableDictionary. Each record gets stored in a NSMutableArray. So far so good. I have function (dont have the source) that requires a NSArray (Description field) be sent to it. I was trying to…
Mark Worsnop
  • 4,407
  • 15
  • 54
  • 79