阅读背景:

无法使用类型的参数列表调用'dataTask'(使用:NSMutableRequest,...)

来源:互联网 

func performGetRequest(_ targetURL: URL!, completion: @escaping (_ data: Data?, _ HTTPStatusCode: Int, _ error: NSError?) -> Void) {
    let request = NSMutableURLRequest(url: targetURL)
    request.httpMethod = "GET"

    let sessionConfiguration = URLSessionConfiguration.default

    let session = URLSession(configuration: sessionConfiguration)

    let task = session.dataTask(with: request, completionHandler: { (data: Data?, response: URLResponse?, error: NSError?) -> Void in
        DispatchQueue.main.async(execute: { () -> Void in
            completion(data, (response as! HTTPURLResponse).statusCode, error)
        })
    })

    task.resume()
}
func performGetRequest(_ targetURL: URL!, co



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: