我对Swift3中的以下代码有问题。我不确定我做错了什么,但是当我尝试打印'list‘时,我收到了一个编译器错误'Use of unresolved identifier’。有人能告诉我正确的方向吗?
let task = URLSession.shared.dataTask(with: request) { data, response, error in
DispatchQueue.main.async {
if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode == 200 {
do {
let json = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.mutableContainers) as? [String: Any]
guard let list = json?["response"] as? [[String : Any]] else {
return
}
} catch {
print("catch error...")
}
} //end of if let httpStatus
}//end dispacth
}//end of task
task.resume()
print(list)https://stackoverflow.com/questions/41453233
复制相似问题