AFHTTPRequestOperationManager给出请求失败错误

时间:2013-11-04 09:34:25

标签: ios objective-c afnetworking-2

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

manager.requestSerializer = [AFHTTPRequestSerializer serializer]; //not working with or without this.

NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"id", @"id", @"pwd", @"pwd", @"func", @"func", nil];

[manager POST:@"http://someurl.com/abc/func.php" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"Success: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"Error: %@", error);
}];

为什么我要

  

错误域= AFNetworkingErrorDomain代码= -1016“请求失败:   不可接受的内容类型:text / html“UserInfo = 0x1f89e740   {NSErrorFailingURLKey = http://someurl.com/abc/func.php,   AFNetworkingOperationFailingURLResponseErrorKey =,NSLocalizedDescription =请求失败:不可接受   content-type:text / html}

0 个答案:

没有答案