Error Domain = com.alamofire.error.serialization.response Code = -1011" Request failed:internal server error(500)" [英] Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)"

查看:695
本文介绍了Error Domain = com.alamofire.error.serialization.response Code = -1011" Request failed:internal server error(500)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用afnetworking。

I am using afnetworking in my application.

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

To post data on server I wrote following code

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

    }];
}

但作为回应我收到以下错误

But in response I got following error

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

我不明白我在哪里制作。
任何帮助都是适合的。

I don't understand where I made mitake. Any help would be appriciable.

推荐答案

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

I think you're ok. Your server returns an error to your request. Code 500 usually means internal error such as unhandled exception. So it definitely has nothing to do with client.

这篇关于Error Domain = com.alamofire.error.serialization.response Code = -1011&quot; Request failed:internal server error(500)&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆