Reputation: 704
Getting the error Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x16e09f70'
if (finalArray.count != 0)
{
NSMutableDictionary *fetchDict = [[NSMutableDictionary alloc]initWithDictionary:[finalArray objectAtIndex:indexPath.row]];
NSMutableArray *valueArr = [[NSMutableArray alloc]initWithArray:[fetchDict allValues].mutableCopy];
for (NSMutableArray *one in valueArr) {
for (NSMutableArray *two in one) // Program Stops on This Line
{
cell.textLabel.text = [NSString stringWithFormat:@"%@",[two valueForKey:@"Note"]];
}
}
}
}
Upvotes: 4
Views: 7182
Reputation: 2557
Try this
if (finalArray.count != 0)
{
NSMutableDictionary *fetchDict = [[NSMutableDictionary alloc]initWithDictionary:[finalArray objectAtIndex:indexPath.row]];
NSMutableArray *valueArr = [[NSMutableArray alloc]initWithArray:[fetchDict allValues].mutableCopy];
for (NSMutableArray *one in valueArr) {
if ([one isKindOfClass:[NSMutableArray class]]) { //Check if array here
for (NSMutableArray *two in one)
{
cell.textLabel.text = [NSString stringWithFormat:@"%@",[two valueForKey:@"Note"]];
}
}else {
NSLog(@"Program stops because this one: %@", one);
}
}
}
Upvotes: 4
Reputation: 2777
Try this
if (finalArray.count != 0)
{
NSDictinory *fetchDict = [finalArray objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@",[fetchDict valueForKey:@"Note"]];
}
}
hope this helps.
Upvotes: 1