I had an NSURLConnection and all relevant methods working in the same view controller. Then I moved it to UICollectionViewController and got an exception below
- (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); } }
Error: * Application termination due to the uncaught exception "NSInvalidArgumentException", reason: "data parameter is nil"
Does anyone have any ideas?
source share