错误域= com.alamofire.error.serialization.response代码= -1011“请求失败:内部服务器错误(500)”

问题描述:

我在我的应用程序中使用afnetworking。错误域= com.alamofire.error.serialization.response代码= -1011“请求失败:内部服务器错误(500)”

要发布的数据在服务器上我写了下面的代码

- (void) callLoginAPI:(NSDictionary *)dictProfile{ 
    // 1 

    NSDictionary *params = @{@"username":[dictProfile valueForKey:@"name"], 
          @"first_name":[dictProfile valueForKey:@"first_name"], 
          @"last_name":[dictProfile valueForKey:@"last_name"], 
          @"email":[dictProfile valueForKey:@"email"], 
          @"dob":[dictProfile valueForKey:@"birthday"], 
          @"gender":[dictProfile valueForKey:@"gender"], 
          @"location":[[dictProfile valueForKey:@"location"] valueForKey:@"name"], 
          @"timezone":[dictProfile valueForKey:@"timezone"], 
          @"language":@"", 
          @"profile_pic_url":[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=large",[dictProfile valueForKey:@"id"]], 
          @"cover_pic_url":@"" 
          }; 

    NSString* HOST_URL = [NSString stringWithFormat:@"%@login/",BASE_URL]; 

    AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager]; 
    operationManager.requestSerializer = [AFJSONRequestSerializer serializer]; 

    [operationManager POST:HOST_URL parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject){ 
     NSLog(@"resp:%@",responseObject); 
     // Enter what happens here if successsful. 

    }failure:^(AFHTTPRequestOperation *operation, NSError *error){ 
     NSLog(@"error:%@",error); 
     // Enter what happens here if failure happens 

    }]; 
} 

但在回答我得到了以下错误

error:Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo=0x7cc8bb50 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x7ca9d4d0> { URL: http://10.1.81.35:8000/api/login/ } { status code: 500, headers { 
    "Content-Type" = "text/html"; 
    Date = "Tue, 07 Oct 2014 08:25:40 GMT"; 
    Server = "WSGIServer/0.1 Python/2.7.6"; 
    Vary = Cookie; 
    "X-Frame-Options" = SAMEORIGIN; 
} }, NSErrorFailingURLKey=http://10.1.81.35:8000/api/login/, NSLocalizedDescription=Request failed: internal server error (500), 

我不明白的地方我做了三岳。 任何帮助将是appriciable。

我认为你没事。您的服务器向您的请求返回错误。代码500通常意味着内部错误,例如未处理的异常。所以它绝对与客户无关。