I have this call with AFNetworking 1.0 that returns a responseObject
with the data from the API that I want:
[[AFDiffbotClient sharedClient] postPath:@"http://diffbot.com/api/batch" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
However, I have no idea how to process responseObject
.
If I check [responseObject class]
I get NSData
.
If I NSLog(@"%@", responseObject)
I get a bunch of numbers (memory addresses I assume):
<5b0a7b22 68656164 65727322 3a5b7b22 6e616d65 223a6e75 6c6c2c22 76616c75 65223a22 48545450 2f312e31 20323030 204f4b22 7d2c7b22 6e616d65 223a2244 61746522 2c227661 ...
If I do:
NSString *responseString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSLog(@"%@", responseString);
I get the output that I want! But, it's an NSString
.
If I do:
NSError *error;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:responseObject options:kNilOptions error:&error];
NSLog(@"%@", responseDictionary);
I get an NSDictionary
, but it's missing the vast majority of the response (i.e.: I don't get what's included with the NSString
method).
How should I be processing this object?