swift - 在网络服务调用期间部分应用转发器

标签 swift closures

找到了这些文章,但不知道它们有什么帮助:

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

我在下面的代码中得到部分应用转发器:

    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 有关?

谁能帮我指出这个问题?

最佳答案

经过大量挖掘和敲打,我注意到右侧的 xcode Pane 中有一些东西:

nsurlsession nsurlconnection http 加载失败 kcfstreamerrordomainssl -9802

我用谷歌搜索了一下,发现了这个问题:

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

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

哎呀!

关于swift - 在网络服务调用期间部分应用转发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46027528/

相关文章:

ios - iOS 系统从 9 - 10 升级后,字体中缺少符号 '$£¥ €'

swift - 如何在 appRTC iOS 中本地录制和保存 RTCVideoTrack?

ios - 如何在 uitableview 自定义单元格中隐藏标签

enums - 在 Swift 中,是否可以在编译时为枚举的关联值预填充值?

c++ - 是否可以在 C++11 之前创建函数局部闭包?

ios - Xcode 8.1 中的 "Segmentation fault: 11"

uitableview - 按下按钮时在 UITableViewCell 中找到按钮的 indexPath?

ios - Swift 5 闭包解释

javascript - 缺少分号意外中断脚本

swift - 在 Swift 中关闭?