2014-10-07 22 views
6

Tôi đang sử dụng tính năng liên mạng trong ứng dụng của mình.Miền lỗi = com.alamofire.error.serialization.response Code = -1011 "Yêu cầu không thành công: lỗi máy chủ nội bộ (500)"

Để gửi dữ liệu trên máy chủ của tôi đã viết mã sau

- (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 

    }]; 
} 

Nhưng trong phản ứng tôi đã lỗi sau

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), 

Tôi không hiểu nơi tôi làm Mitake. Bất kỳ trợ giúp nào cũng sẽ hữu ích.

Trả lời

2

Tôi nghĩ bạn ổn. Máy chủ của bạn trả về lỗi cho yêu cầu của bạn. Mã số 500 thường có nghĩa là lỗi nội bộ chẳng hạn như ngoại lệ chưa được xử lý. Vì vậy, nó chắc chắn không có gì để làm với khách hàng.

Các vấn đề liên quan