I have NSMutableArray that contains NSArray and String:
NSMutableArray *alphabets = [[NSMutableArray alloc] init];
[alphabets addObject:[NSArray arrayWithObjects:@"ㄱ",@"ㄲ", nil]];
[alphabets addObject:@"ㄴ"];
[alphabets addObject:[NSArray arrayWithObjects:@"ㄷ",@"ㄸ", nil]];
[alphabets addObject:@"ㄹ"];
[alphabets addObject:@"ㅁ"];
[alphabets addObject:[NSArray arrayWithObjects:@"ㅂ",@"ㅃ", nil]];
[alphabets addObject:[NSArray arrayWithObjects:@"ㅅ",@"ㅆ", nil]];
[alphabets addObject:@"ㅇ"];
[alphabets addObject:[NSArray arrayWithObjects:@"ㅈ",@"ㅉ", nil]];
[alphabets addObject:@"ㅊ"];
[alphabets addObject:@"ㅋ"];
[alphabets addObject:@"ㅌ"];
[alphabets addObject:@"ㅍ"];
[alphabets addObject:@"ㅎ"];
I want to check if object count by index is bigger than 1 then I can know my alphabet has contains arrays that has multiple values. Here is the code:
for (int i = 0 ; i < [alphabets count]; i++){
if([[alphabets objectAtIndex:i] count] > 1){
NSLog(@"multiple values");
}else{
NSLog(@"%@", [alphabets objectAtIndex:i]);
}
}
But the code is always get errors.
This is the error: unrecognized selector sent to instance 0x2d550
How to count objects by index? Please help me to solve it.
Thank
if ([alphabets[i] isKindOfClass:[NSArray class]]).