Reputation: 774
I've got arrays in a NSMutableDictionary which is named favToLoad. I'm trying to get the arrays one by one with the indexPath.row of a UITableView.
Code :
NSArray* fav = [[NSArray alloc] init];
NSLog(@"IndexPath = %d", indexPath.row);
fav = [favToLoad objectAtIndex:indexPath.row];
NSLog(@"Fav = %@", fav);
The error:
[NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance
Solution
I've solved my problem by using NSMutableArray instead of NSMutableDictionary
Upvotes: 0
Views: 5084
Reputation: 5175
you should use objectForKey:
instead of objectAtIndex:
objectAtIndex:
valid for NSArray
classes
Upvotes: 1
Reputation: 41801
Dictionaries don't have indices. You can't do this. Instead, you need to use -objectForKey: with the appropriate key to get the value you want (you can use 'po favToLoad' in the debugger to inspect the contents).
Upvotes: 4