i am using AFNetworking framework in the my project & accessing webservice via AFHTTPSessionManager class like following way,
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager.requestSerializer setTimeoutInterval:30];
NSDictionary *parametersDictionary = @{
@"users_id":userIDStr,
@"name" :@""
};
[manager POST:@"api/call_XAPI?"
parameters:parametersDictionary
progress:^(NSProgress * _Nonnull uploadProgress) {
}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"Success");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"%@", error);
}];
This is working properly on success but when if any error occurs in server then error response not getting in proper format on the console
Printing description of error:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x608000435940> { URL: http://www.example.com/api/call_XYZAPI? } { status code: 500, headers {
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Type" = "application/json";
Date = "Mon, 30 Jan 2017 13:12:59 GMT";
Server = "nginx/1.10.2";
"Set-Cookie" = "laravel_session=ca9b0725b981267be1f095bb6ae14a1d5ae2825f; expires=Mon, 30-Jan-2017 15:12:59 GMT; Max-Age=7200; path=/; httponly";
"Transfer-Encoding" = Identity;
} }, NSErrorFailingURLKey=http://www.example.com/api/call_XYZAPI?, com.alamofire.serialization.response.error.data = 12112,23131,31231331,312231 .....
Can anyone tell me what i am doing wrong & how to resolve this issue?