在网络服务电话

时间:2017-09-03 20:25:00

标签: swift closures

找到这些文章,但无法弄清楚它们是如何帮助的:

Understanding crash report (Partial apply...) in Swift Swift closure crashes when called as Objective-C block

我在下面的代码中获得了Partial Apply Forwarder:

    let task = session.dataTask(with: request, completionHandler: {
        (data, response, error) in

        if error == nil {
            let result = String(data: data!, encoding: String.Encoding.utf8)!
            if WebService.THETA_INVALID == result {
                failure(LoginService.INVALID_MESSAGE)
            }
            else if WebService.THETA_UNVALIDATED == result {
                failure(LoginService.UNVALIDATED_MESSAGE)
            }
            else {
                let loginCredentials = LoginCredentials()
                loginCredentials.username = user
                loginCredentials.password = password
                loginCredentials.authorization = result
                success()
            }
        } else {
            failure(error!.localizedDescription)
        }

    })
    task.resume()

错误object.failure包含" Partial Apply Forwarder"我不知道这意味着什么。我尝试使用谷歌搜索,它似乎与选项有关,但大多数事情都与Thunk有关?

任何人都可以帮我指出这个问题吗?

1 个答案:

答案 0 :(得分:1)

经过多次挖掘和敲击后,我注意到了正确的xcode窗格中的内容:

nsurlsession nsurlconnection http加载失败kcfstreamerrordomainssl -9802

我用Google搜索并发现了这个问题:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) in iOS 9 with Xcode 7.1

所以我在info.plist中创建了一个名为App Transport Security Settings的字典,然后添加了一个名为Allow Arbitrary Loads的密钥。我将它设置为布尔值true并重新运行我的测试,一切正常。

糟糕!