错误域= NSPOSIXErrorDomain代码= 54“操作无法完成。连接由同行重置”

时间:2014-10-07 07:01:33

标签: objective-c iphone afnetworking-2

我正在使用AFNetworking在服务器上发布数据并获得响应。

以下是我的代码。

- (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"]]
                             };
    NSString* HOST_URL = [NSString stringWithFormat:@"%@/login/",BASE_URL];

    AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager];
    [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 Domain=NSPOSIXErrorDomain Code=54 "The operation couldn’t be completed. Connection reset by peer" UserInfo=0x787f0ec0 {_kCFStreamErrorCodeKey=54, NSErrorFailingURLStringKey=http://10.1.81.35:8000/api//login/, NSErrorFailingURLKey=http://10.1.81.35:8000/api//login/, _kCFStreamErrorDomainKey=1}

谁能告诉我哪里弄错了。

感谢。

0 个答案:

没有答案