使用PUT方法时AFNetworking出错

时间:2015-06-10 07:36:31

标签: ios objective-c

使用PUT方法时会出现此错误。

PARAMS:

NSDictionary *dict = @{@"name" : @"aorg",
                       @"email" : @"murali@gmail.com",
                       @"password" : @"hdhd"
                      };

 Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo=0x7b949450 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7b767670> { URL: http://my url} { status code: 500, headers {
        Connection = "keep-alive";
        "Content-Length" = 0;
        Date = "Wed, 10 Jun 2015 07:31:51 GMT";
        Pragma = cache;
        Server = "nginx/1.6.2 (Ubuntu)";
    } }, NSErrorFailingURLKey=http:my url, NSLocalizedDescription=Request failed: internal server error (500), com.alamofire.serialization.response.error.data=<>}
用于 AFNetworking

管理器

  AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

    if(reqJSONSerialized == NO){
        manager.requestSerializer = [AFHTTPRequestSerializer serializer];
        //[manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    } else {
        manager.requestSerializer = [AFJSONRequestSerializer serializer];
        [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        //[manager.requestSerializer setValue:@"very_secret_token" forHTTPHeaderField:@"x-access-token"];
        [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    }

0 个答案:

没有答案