URLSession.shared请求崩溃Swift 3

时间:2016-09-14 22:00:14

标签: ios swift

为什么这件事崩溃只是无法弄清楚

        var request = URLRequest(url: URL(string: url)! )
        request.httpMethod = "POST"
        request.httpBody = try! JSONSerialization.data(withJSONObject: params, options: [])
        request.addValue("application/json", forHTTPHeaderField: "Content-Type")

        let task = URLSession.shared.dataTask(with: request, completionHandler: {data, response, error -> Void in
            guard let responceSafe = response else {
            completion([:], 0)
                return
            }
/*some not related code*/
}

这里错误日志看起来有多奇怪:

Assertion failed: (isForProxy(authConfig.getConnectionType())), function updateWithResponse, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-808.0.2/HTTP/HTTPAuthentication/AuthenticationHelpers.cpp, line 1168.

1 个答案:

答案 0 :(得分:1)

对我来说,是InMobi惹麻烦了。 InMobi是第3个SDK。 当我删除有关它的代码时,崩溃就会消失!

相关问题