我有NSURLConnection的和所有在一个视图控制器工作适当的方法。然后我把它移动到UICollectionViewController并获得以下的iOS:NSJSONSerialization导致“数据paremeter是零”
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *jsonParsingError = nil;
//error right here!
NSString
*object = [NSJSONSerialization JSONObjectWithData:self.jsonReceivedData options:NSJSONReadingMutableContainers error:&jsonParsingError];
if (jsonParsingError) {
NSLog(@"JSON ERROR: %@", [jsonParsingError localizedDescription]);
} else {
NSLog(@"LIST: %@", object);
}
}
错误的异常。是: *终止应用程序由于未捕获的异常“NSInvalidArgumentException”,原因:“数据参数是零”
任何人有任何想法
想法:尝试了解异常消息。 – 2013-04-30 06:38:44
我想self.jsonReceivedData无效。这就是为什么它无法序列化。检查你的jsonReceivedData。 – 2013-04-30 06:40:52
你不能要求更好的错误信息.. – Krishnabhadra 2013-04-30 06:41:16