我正在将Swift 2.2项目更新为Swift 3,并在“let session = URLSession(configuration:config)”行中收到以下错误:
无法使用类型为'(configuration:URLSessionConfiguration)'的参数列表调用'URLSession'
这是我的代码:
let urlPath: String = "http://iosquiz.com/service.php"
let url: URL = URL(string: urlPath)!
var request = URLRequest(url:url)
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
let task = session.dataTask(with: url as URL)
task.resume()
感谢任何帮助!