I have a UITextField and I want to update my server when I write something in UITextField and press update button, I used AFNetworking, but I have an error :
Domain=com.alamofire.error.serialization.response Code=-1011
"Request failed: internal server error (500)
{ status code: 500, headers {
"Access-Control-Allow-Headers" = "Origin, X-Requested-With, Content-Type, Accept";
"Access-Control-Allow-Methods" = "OPTIONS,GET,POST,PUT,DELETE";
"Access-Control-Allow-Origin" = "*";
Connection = "keep-alive";
"Content-Type" = "text/plain";
Date = "Thu, 24 Jul 2014 00:41:56 GMT";
Server = Cowboy;
"Transfer-Encoding" = Identity;
Via = "1.1 vegur";
"X-Powered-By" = Express;
} }, NSLocalizedDescription=Request failed: internal server error (500)}
Here is my Update button code:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSDictionary *params = @ {@"status" :_status};
[manager POST:BASE_URL parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"JSON: %@", responseObject);
}
failure:
^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
Appreciated any help!
Error code, -1011 means kCFURLErrorBadServerResponse
(from docs). Your web service (API) giving you response for which your request/response serializer of AFNetworking
doesn't know. Ask your developer team to see and correct the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With