AFNetworking/AFNetworking — Issue #175: AFJSONRequestOperation empty JSON?
Author: phstc
Created: 2012-01-15 03:01:01+00:00
State: open

Hello

I trying to parse a JSON, but the JSON is coming empty (0x0).

I thought that it should be a problem in my JSON, but I changed for Twitter JSON and I'm still getting empty JSON.

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://search.twitter.com/search.json?q=@pablocantero"]];

AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {

/* JSON comes 0x0 */

NSLog(@"completed_in: %@", [JSON valueForKeyPath:@"completed_in"]);

/* [JSON valueForKeyPath:@"completed_in"] returns null */

} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"%@", error);
}];

NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[queue addOperation:operation];

I'm using ARC, but I configured -fno-objc-arc in the AF*.

Any help will be appreciated!

Cheers,
Pablo Cantero