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
-1
votes
2 answers

Crash when accessing NSMutableDictionary by string, in 2 different ways?

I have the following method: -(QFFriend*)getFriendById:(NSString*)fid { TFLog(@"NList %@", self.nFlist); TFLog(@":%@:%@:", @"3", fid); TFLog(@"%@", [self.nFlist valueForKey:@"3"]); // TFLog(@"%@", [self.nFlist…
netdigger
  • 3,659
  • 3
  • 26
  • 49
-1
votes
3 answers

filtering Dictonaries in array

Here I want to filter dictionary in the array which contains the "cate = subcat" could anybody help me please menuArr :( { Cate = subcat; Description = "Grilled Chicken"; Id = 2; Image =…
dineshprasanna
  • 1,284
  • 4
  • 20
  • 37
-1
votes
2 answers

store RSS data in NSDictionary

I work on a project in which you can let display RSS feeds in a UITableView. When tapping on it will be forwarded to a UIViewController (detailView). My problem is I'm not very familiar with NSDictionary. I've been a little reading about it, but…
CTSchmidt
  • 1,155
  • 3
  • 17
  • 30
-1
votes
2 answers

Update NSMutableArray after adding New object

I have a NSMutableArray which contains some NSMutableDictionary object type. In some situations I have to add one field to each NSMutableDictionary inside this Array, but I don't know how? I do add object (field) into my NSMutableDictionary like…
-1
votes
2 answers

Get dictionary value from array in iOS?

I have the following NSArray: ( { geometry = { location = { lat = "37.789632"; lng = "-122.417004"; }; }; icon =…
Honey
  • 2,840
  • 11
  • 37
  • 71
-1
votes
2 answers

How to assign values from NSMutableDictionary to NSArray

I am doing JSON parsing and I want to show my parsed data in a UITableView. For that, I am trying to assign parsed data from NSMutableDictionary to NSArray to show in the table view but the array returns null. Here my array returns null…
-1
votes
1 answer

copy NSMutableDictionary, ios

Given: An existing NSMutableDictionary named oldDictionary. Goal: Copy oldDictionary to a another dictionary named newDictionary and if newDictionary has been modified – e.g., the values of some keys are changed – then oldDictionary should…
tranvutuan
  • 6,089
  • 8
  • 47
  • 83
-2
votes
3 answers

Memory Leak when returning NSMutableDictionary object

I have memory leaks in the aTierOneData and when i tried [aTierOneData autorelease] , my app crashed.so how i can fix this memory leak. Plese let me know //=============================================================== - ( NSMutableDictionary *…
user198725878
  • 6,266
  • 18
  • 77
  • 135
-2
votes
3 answers

How to add NSMutableDictionary values in NSMutableArray

I have one NSMutableDictionary with different keys and values. All key values I need to save in NSMutableArray in Swift3. Here is my NSMutableDictionary : { 92 = ( "", "
user2786
  • 656
  • 4
  • 13
  • 35
-2
votes
1 answer

How to retrieve values for key 2 into NSString?

How to retrieve values for key 2 of a NSMutableDictionary into NSString? My response data is given response{ 0 = { email = "grover@gmail.com"; firstname = Grover; }; 1 = { email = "hems@gmail.com"; firstname = Gems; }; 2 = { email =…
Gurp321
  • 109
  • 2
  • 11
-2
votes
2 answers

Not creating a new instance of NSMutableDictionary when passing to another class

i have an NSMutableDictionary declared in a class but i want to print get access to the contents of it in another class for example @interface MyClass0 : NSObject { } @property (nonatomic, strong) NSMutableDictionary *valuee; @end and in…
Aryan Kashyap
  • 121
  • 1
  • 12
-2
votes
5 answers

How to add Nsmutabledictionary data into Nsmutablearray.?

i am geting data in a nsmutabledictionay from api and i need to add this data into tableview cell, so i need to convert it into nsmutable array. but when tried to add data from dictonary to aarray it picks only last object of dictonary. pleae look…
sandeep tomar
  • 303
  • 1
  • 5
  • 17
-2
votes
5 answers

How to get an object from NSMutableDictionary?

I tried to get some data from NSMutableDictionary, - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ long time = (long)[[tempPosts allKeys] objectAtIndex:section]; return [[tempPosts…
codebot
  • 2,540
  • 3
  • 38
  • 89
-2
votes
1 answer

NSDictionary use

I need some kind of help with an explanation to understand how use a NSDirectory, i don´t know if is possible to insert a NSString or NSDictionary's data from a class "A" in another NSDictionary in class B Class A String NSString *TwitterToken =…
-2
votes
6 answers

Adding NSMutableDictionary to NSMutableArray

NSMutableArray *arrData =[NSMutableArray array]; arrData =[data objectForKey:@"data"]; NSLog(@"%@",arrData); NSLog will print like data = ( { date = "2016-01-20"; "end_time" = "12:25:00"; "start_time" = "11:00:00"; …
Chandrika Visvesh
  • 91
  • 1
  • 1
  • 10