【发布时间】:2013-04-03 12:52:18
【问题描述】:
我试图在 tempArray 中添加偶数个 data.localBookmarks 是字典数组。这是我的代码:
currentIndex = indexPath.row;
for (NSDictionary *dict in localBookmarks)
{
if (currentIndex % 2 == 0 && currentIndex <= [localBookmarks count])
{
[tempArray addObject:[dict objectForKey:@"firstName"]];
}
currentIndex++;
}
NSLog(@"tempArray %@",tempArray);
cell.textLabel.text = [tempArray objectAtIndex:indexPath.row];
return cell;
我的应用程序在 [tempArray addObject:[dict objectForKey:@"firstName"]] 上崩溃;这条线,我该如何解决?
【问题讨论】:
-
嗯,从错误消息中很明显...
dict实际上是一个字符串(即检查您的localBookmarks是否只包含字典) -
wt 是 localBookMarks ??是 NSDictionary 吗??
标签: iphone objective-c nsmutablearray nsdictionary