什么是payload_data?我收到了这个错误:
无法读取数据,因为格式不正确。
import Foundation
public class APIClient<T: APIProtocol> {
let taskManager = TaskRequestManager()
public typealias handler = ([Dictionary<String, Any>]?, NetworkError?) -> ()
}
extension APIClient {
public func execute(apiService: T, completion: @escaping handler) {
let task = self.taskManager.run(apiService) { result in
switch result {
case .error(let error):
completion(nil,error)
case .success(let json):
let response = json["response"] as! [String: Any]
completion(response["results"] as? [Dictionary<String, Any>],nil)
}
}
task.resume()
}
}