質問

I'm using latest AFNetworking for my app which speaks with REST API server.

When I get some 500 error from it with JSON body something like

{ "message": "my error message" },

I cannot retrieve this message from NSError which lib responds to me:

[api setupUser:data success:^(AFHTTPRequestOperation *operation, id responseObject) {
   // some success handle
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
   // cannot get json response of error :(
}];

How do you workaround it?

役に立ちましたか?

解決

The answer was simple - operation.responseObject in failure callback contains json data as well. Sweet ^.^

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top