payload_data Xcode - 无法读取数据

时间:2018-06-13 22:38:11

标签: ios swift xcode

什么是payload_data?我收到了这个错误:

  

无法读取数据,因为格式不正确。

enter image description here

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()
    }
}

0 个答案:

没有答案