1

I have plist file and I am using CHDictionary to get them ordered. When I use "allKeys" to get the keys, there is no problem.

Here is the sample:

//1
NSString *pathListNames = [[NSBundle mainBundle] pathForResource:@"menuListNames" ofType:@"plist"];

//2
CHOrderedDictionary *dictName = [[CHOrderedDictionary alloc] initWithContentsOfFile:pathListNames];

//3
NSArray *temp = [dictName allKeys];

NSLog(@"KEY FIRST ONE %@", temp[0]);

However when I want to get some keys with a specified range and I decided to use "keysAtIndexes" like following:

//1
NSString *pathListNames = [[NSBundle mainBundle] pathForResource:@"menuListNames" ofType:@"plist"];


//2
CHOrderedDictionary *dictName = [[CHOrderedDictionary alloc] initWithContentsOfFile:pathListNames];

//3
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 3)];

NSArray *temp = [dictName keysAtIndexes:indexSet];

NSLog(@"KEY FIRST ONE %@", temp[0]);

I am getting an exception like this

"'NSInvalidArgumentException', reason: '-[__NSCFDictionary keysAtIndexes:]: unrecognized selector sent to instance".

I will be happy if someone can tell me the reason why keysAtIndexes:indexSet is causing the exception.

Thanks in Advance.

Reaper
  • 124
  • 2
  • 16

0 Answers0