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“请求失败:不可接受的内容类型:文本/html” UserInfo=0x1f89e740 {NSErrorFailingURLKey= http://someurl.com/abc/func.php,AFNetworkingOperationFailingURLResponseErrorKey=,NSLocalizedDescription=请求失败:不可接受内容类型:文本/html}