Reputation: 3233
I am working on an app where I have AFNetworking fetching JSON
requests from the my server. Now JSON
is dynamically created based upon the POST
variables I send from my app.
I was wondering when I get the following error message
JSON text did not start with array or object and option to allow fragments not set.
Is there a way to adapt my code so that I can actually see in the logger what the returned JSON request looks like. I have a feeling that there is a warning popping up in my PHP that is throwing off the JSON but I am not sure what it is.
Here is my code, it would make it so much easier if I could lets say NSLog the body content.
[manager POST:@"__MY__URL__" parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
} progress:nil success:^(NSURLSessionDataTask *operation, id responseObject) {
NSLog(@"Success: %@", responseObject);
if([[responseObject objectForKey:@"state"] isEqualToString:@"success"]){
//[self performSegueWithIdentifier:@"client_choose_ad" sender:self];
}else {
[self alertError:@"Unable To Create Advert" alertMessage:[responseObject objectForKey:@"message"]];
}
} failure:^(NSURLSessionDataTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
Upvotes: 0
Views: 117
Reputation: 1248
Maybe printing the raw data of the request is what you are looking for.
How to print AFNetworking request as RAW data
Upvotes: 1