在这种情况下,“方法”对于类型查找不明确,Alamofire中的错误 [英] 'Method' is ambiguous for type lookup in this context, Error in Alamofire
本文介绍了在这种情况下,“方法”对于类型查找不明确,Alamofire中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在迅速地使用Alamofire进行网络处理,并遇到一个奇怪的错误。似乎我们无法将方法枚举作为参数传递。
[方法参数上出现错误]
I am using Alamofire for network handling in swift and run into one weird error. It seems like we can't pass Method enum as parameter.
[Error is on Method parameter]
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
You have to specify the module from which to lookup object type.
Call Alamofire.Method
这篇关于在这种情况下,“方法”对于类型查找不明确,Alamofire中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文