我正在使用Alamofire進行網絡處理,並且遇到了一個奇怪的錯誤。好像我們不能通過方法 enum作爲參數。
[錯誤是對方法參數]'方法'在這種情況下對於類型查找是不明確的,Alamofire中的錯誤
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