I am using AFHTTPRequestOperationManager to request a POST . Now I'm intentionally entering the wrong information to handle the 400 error code. Now the web service actually returns JSON with a message explaining to the user what they did wrong. I would really like this JSON display the message in a UIAlertView . However, the failure unit:
[operationManager POST:ServerURL parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"Success: Status Code: %d", operation.response.statusCode); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Failed: Status Code: %d", operation.response.statusCode); }];
does not skip the response object as an object in the success block. So does anyone know how I can access the JSON returned by the web service with a 400 error? NSError *error just gives me Request failed: bad request (400) rather than returning JSON.
Any help would be appreciated, Mike
source share