小编Vag*_*ado的帖子

Objective-C - iOS11中的任务的HTTP加载失败(错误代码:-1004 [1:61])

我正在尝试使用URLSession执行数据任务,当我在iOS11设备(iPhone 5S)上运行它时出现控制台错误:

2017-09-22 15:22:17.942015-0300 app[1355:283536] TIC TCP Conn Failed [3:0x1c417af40]: 1:61 Err(61) 
2017-09-22 15:22:17.943698-0300 app[1355:283536] Task <A32F0275-75C3-4F64-AB92-2E37527AB813>.<0> HTTP load failed (error code: -1004 [1:61])
2017-09-22 15:22:17.945265-0300 app[1355:283676] NSURLConnection finished with error - code -1004
Run Code Online (Sandbox Code Playgroud)

在模拟器上运行它不会发生.

是什么导致它或如何解决它?

这就是我正在做的事情

#define kEcardURL @"https://example.com/mobile/services/ecard/"

- (void)doSomething {

    //Params Configuration
    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
                          [oauth.userData valueForKey:@"wsuserid"], @"token",
                          nil];

    NSString *path = @"fotoCartao";
    NSData* params = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kEcardURL, path]];
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
    [urlRequest setHTTPMethod:@"POST"]; …
Run Code Online (Sandbox Code Playgroud)

http ios11

6
推荐指数
1
解决办法
6036
查看次数

标签 统计

http ×1

ios11 ×1