I am trying to make a POST request using AFNetworking 2.0. This is the code
NSMutableDictionary *params=[NSMutableDictionary dictionary];
[params setValue:@"iOS" forKey:@"device"];
[params setValue:@"" forKey:@"token"];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager POST:ServerURL parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@",responseObject);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@",error);
}];
I have followed many question and they all have done something similar to what i have done above . I do not understand what i am missing. i get a valid response using the old Afnetworking library.
The error i get is
{ status code: 200, headers { Connection = close; "Content-Length" = 195; "Content-Type" = "text/html; charset=UTF-8"; Date = "Mon, 21 Apr 2014 06:53:55 GMT"; Server = "Apache/2.2.25 (Amazon)"; "X-Powered-By" = "PHP/5.3.27"; } }, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}