【发布时间】:2014-09-29 20:53:14
【问题描述】:
在我的应用中,用户可以查看自己的统计信息。我从 Parse 中检索一个数组,如下所示:
...
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
userArray = [objects valueForKey:@"myArray"];
}];
当数组实际上包含某些内容时,代码可以正常工作...但是如果没有任何内容保存到 Parse.com 中的数组中,我会收到错误..
示例: 我运行这段代码来测试:
NSLog(@"%lu", (unsigned long)[[userArray objectAtIndex:0] count]);
当数组包含某些内容时,它会记录正确的数字(有效)。但是当数组为空时,我得到这个错误:
"-[NSNull count]: unrecognized selector sent to instance 0x199084fe0"
我不知道发生了什么。。有人知道发生了什么吗?
【问题讨论】:
标签: ios xcode cocoa-touch parse-platform nsarray