我收到了这个错误:
无法将nsdictionary类型的值转换为预期的参数类型字符串
let json:NSDictionary = try JSONSerialization.jsonObject(with: dataResponse, options: []) as! NSDictionary
self.performSelector(onMainThread: Selector(updateUIwithJsonResponse), with: json, waitUntilDone: true)
performSelector
正在调用此函数:
func updateUIwithJsonResponse(json:NSDictionary) {
print(json)
}
你们中的任何人都知道我为什么会收到这个错误?
答案 0 :(得分:1)
您的方法需要一个参数,因此请尝试
self.performSelector(onMainThread: #selector(updateUIwithJsonResponse(json:)), with: json, waitUntilDone: true)