I had the NSURLConnection and all the appropriate methods working in one view controller. Then i moved it to a UICollectionViewController and get 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);
    }
}
The error is: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
Anyone have any ideas?
The exception message is saying to you that the variable : self.jsonReceivedData is nil, and  the method you are calling  JSONObjectWithData do not support nil data ...
Initialize self.jsonReceivedData field to resolve the problem ;-) .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With