search

Home  >  Q&A  >  body text

objective-c - ios code =-1001 请求超时

如图这是报的错误

NSDictionary *parameter=@{@"start":@(start),@"uid":@([LocalStore getUid]),@"muid":[LocalStore getMuid],@"count":@(count)};

[_manager POST:NET_DOMAIN parameters:parameter progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
    NSNumber *error_code = [responseObject objectForKey:@"status"];
    if([error_code intValue] == 1){
        completion(YES, [responseObject objectForKey:@"data"], 0);
    }else{
        completion(NO, [responseObject objectForKey:@"data"], 1);
    }
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
    NSLog(@"error:%@",error);
    if ([error code] == -1005) {
        [self getAloneList:start andCount:count andblock:completion];
    }else{
        if (_is_hand_break == NO) {

// completion(NO, [self getErrorMsg:error], 1);

            completion(NO, [NSString stringWithFormat:@"%@",error], 1);
        }
    }
}];

这是代码 有的时候会报这个错误 这是为什么 求解答

PHP中文网PHP中文网2809 days ago450

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 17:41:25

    First: Submit the complete request first and put it in the browser simulation to see if it can be requested. If it can, there may be a problem with your code. If not, it means there is a problem with the interface.
    Second: The request timeout may be due to the network being too slow.
    Third: The request times out and the server response may be too slow.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:41:25

    The error message is: ErrorDomain. Check NET_DOMAIN to see if it contains characters in non-UTF format.

    reply
    0
  • Cancelreply