HuangLW HuangLW - 3 months ago 75
Objective-C Question

Code=-1011 "Request failed: internal server error (500)

I meet this problem for 2 days,Android app works well with this background interface,but I always receive the 500 error.My code is like this.

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
[manager POST:urlString parameters:self.param.mj_keyValues success:^(NSURLSessionDataTask *task, id responseObject) {
....
} failure:^(NSURLSessionDataTask *task, NSError *error) {
....
}];


and then,the program goes into the failure block,and I get NSError log like this.

Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7fc26b49a080> { URL: https://training.duapp.com/record_data } { status code: 500, headers {
Server = openresty;
Content-Type = text/html;charset=utf-8;
Vary = Accept-Encoding;
Content-Language = en;
Date = Fri, 02 Sep 2016 03:55:00 GMT;
Content-Encoding = gzip;
Content-Length = 646;
Connection = keep-alive;
}
}, NSErrorFailingURLKey=https://training.duapp.com/record_data, com.alamofire.serialization.response.error.data=


Then I tried to convent the param from NSDictionary to NSData or NSString,and change requestSerializer with it,but all failed with error 500.The format of the param has no error,which is conformed by my background workmate.Can I get any help from you?What should I do?

Answer

Code=-1011 "Request failed: internal server error (500)" is server side issue. Please check with your server team to check because server is returning an error to your request.

Comments