由于未捕获的异常“NSInvalidArgumentException”而导致错误 Terminating app,原因:“-[__NSCFString countByEnumeratingWithState:objects:count:]: 无法识别的选择器发送到实例 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"]];
}
}
}
}
最佳答案
试试这个
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);
}
}
}
关于ios - [__NSCFString countByEnumeratingWithState :objects:count:]: unrecognized selector sent to instance 0x16e09f70',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36328756/