【问题标题】:Partial Apply Forwarder during webservice call在 web 服务调用期间部分应用转发器
【发布时间】:2018-02-12 03:06:41
【问题描述】:

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

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 包含“部分应用转发器”,我不知道这意味着什么。我试过谷歌搜索,它似乎与可选项有关,但大多数事情都与 Thunk 有关?

谁能帮我指出这个问题?

【问题讨论】:

    标签: swift closures


    【解决方案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 的键。我将其设置为 boolean true 并重新运行我的测试,一切正常。

    哎呀!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-19
      相关资源
      最近更新 更多