This is my code for requesting a JSON:
[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"text/html"]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success: ^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON){
NSArray *jsonArray =[JSON valueForKey:@"posts"];
[self postsToAnnotations:[self jsonToPosts:jsonArray] andUserLocationLat:lat Lon:lon];
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON){
NSLog(@"response %@",JSON);
NSLog(@"Failed %@",error);
[_activityView removeFromSuperview];
}];
[operation start];
}
It's working fine on simulator for iPhone 5 and in my device (iphone 4) I am getting this error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x208b9a80 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}