我有 NSURLConnection 和所有适当的方法在一个视图控制器中工作。然后我将它移到 UICollectionViewController 并在下面得到一个异常
- (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”而终止应用程序,原因:“数据参数为零”
有人有想法么?