Reputation: 1577
private func makeRequest<T where T:MappableNetwork>(method method: Alamofire.Method, url: String,
parameters: [String: AnyObject]?, keyPath: String, handler: NetworkHandler<T>.handlerArray) -> Request {
let headers = [
"Authorization": "",
]
return Alamofire
.request(method, url, parameters: parameters, encoding: .URL, headers: headers)
.validate()
.responseArray(keyPath: keyPath) { (response: Alamofire.Response<[T], NSError>) in
if let error = response.result.error {
if let data = response.data {
let error = self.getError(data)
if error != nil {
handler(.Error(error: error!))
return
}
}
handler(.Error(error: error))
} else if let objects = response.result.value {
handler(.Success(data: objects))
}
}
}
I converted code swift 2.x to 3.x and I getting error Type expression is ambiguous without more context.
Upvotes: 5
Views: 11335
Reputation: 3416
The error you mentioned tells you that the compiler cannot determine the exact type of the value you entered.
You started with a period, something has to be before the period. Sometimes the compiler can understand without your help. That's not this case, it has several options so it's ambiguous and it asks you to tell exactly the class name that you meant.
Upvotes: 5