Xcode 8.1 Deployment target iOS 9.0
I'm getting an array of compact venue objects as expected from Foursquare Venue Search endpoint in...
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
When I check the data object using...
if ([NSJSONSerialization isValidJSONObject:data])
i get a false.
Can someone tell me what is wrong over here?
Edit: Here is the complete if block (after adding typecast to data in if block)...
id foundationObject;
NSLog(@"data:- %@",data);
if ([NSJSONSerialization isValidJSONObject:(id)data])
{
foundationObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"venues foundation object:- %@",foundationObject);
}
Earlier the code didn't have the if block. just...
id foundationObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
The change was made when I realized (using breakpoint just after the above statement) that foundationObject was nil even though data wasn't.
Note: this worked fine earlier when I shipped my app for iOS 9.x in march. Could the version of the Venue Endpoint being called be making a difference?