Is there any way to add a value to an existing key on a NSMutableDictionary?
Here is snippet of my code
NSMutableArray *mainFeedList = [NSMutableArray array];
[mainFeedList addObjectsFromArray:feedList];
for(int i = 0; i < mainFeedList.count; i++){
NSMutableArray *allFeed = [NSMutableArray array];
NSString *categoryId = [mainFeedList[i] valueForKey: @"categoryId"];
[allFeed addObject:mainFeedList[i]];
if(allFeed != nil && allFeed.count > 0) {
[feedContent setObject:allFeed
forKey:[combinedCategories[(int)[categoryId integerValue]] valueForKey: @"name"]];
}
Sample scenario:
NSMutableDictionary *mDict = @{@"key1":@"value1",@"key2": @"value2"};
I know that
[mDict setObject:mArray forKey:@"key1"];
will set an object to key1 but what I need is
add another object to key1 without replacing existing object (i need it both)