我在Swift中使用Alamofire进行网络处理时遇到了一个奇怪的错误。 看起来我们无法将 Method 枚举作为参数传递。
[错误出现在Method参数上]
private func apiRequest(method: Method, url: String, apiData: [String : AnyObject], completion:(finished: Bool, response: AnyObject?) ->Void) {
Alamofire.request(method, url, parameters: apiData).responseJSON{ response in
if let JSON = response.result.value {
completion(finished: true, response: JSON)
} else {
completion(finished: false, response:nil)
}
}
}
Alamofire.Method
。对于request
函数,您已经在这样做了。 - Sulthan