AfNetworking错误发布

时间:2012-10-11 10:50:25

标签: ios json ios5 afnetworking

我最近开始在我的项目中使用AfNetworking。 我创建了一个AFClient,实现了所有参数,一切都是为了 GET 方法。 但是,我无法制作 POST 方法: 有我的代码:

            NSDictionary *params = [[NSDictionary alloc]initWithObjectsAndKeys:
                                @"TexttoInsert", @"question",
                                id,@"user_id",
                                nr1,@"number1",
                                nr2, @"number2",
                                nil];


        [[MYClient sharedInstance] postPath:@"insert" parameters:params success:^(AFHTTPRequestOperation *operation, id JSON) {

                                            NSLog(@"%@", JSON);

                                       }
                                       failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                           NSLog(@"RequestOperation:%@",operation);  
                                           NSLog(@"Error:%@",error);  
                                       }];

我收到此错误,但无法解决。

Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 400" UserInfo=0x6cb6330 {NSLocalizedRecoverySuggestion={"success":false,"error":400,"message":"Bad Request"}, 

AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x6a893e0>, NSErrorFailingURLKey=http://myMainUrl/insert, NSLocalizedDescription=Expected status code in (200-299), got 400, AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest http://myMainUrl/insert>}

0 个答案:

没有答案