Generic type 'DataResponse' specialized with too few type parameters (got 1, but expected 2)
deezaster opened this issue · 14 comments
Did you resolve this?
i have this problem too.
I just changed the type DataResponse
to AFDataResponse
.
What I had:
responseData(completionHandler: { (dataResponse: DataResponse<Data>) in }
What I have now:
responseData(completionHandler: { (dataResponse: AFDataResponse<Data>) in }
I've got error when updated Alamofire from 5.0.0-beta.7 to 5.0.0-rc.2
You can look here #284
Closing as the PR to fix this has been merged and released
Hi
I'm still getting this error with below pods, i tried all mentioned Git master but nothing working.
Getting this error in XCODE11 with swift 5.
When i use AFDataResponse instead of DataResponse then issue go away. i don't whether its the correct approach to resolve the same ?
Please Help me to get out of it. thanks
pod 'Alamofire', '> 5.0.0-rc.2'> 3.4'
pod 'ObjectMapper', '
#pod 'AlamofireObjectMapper', :git => 'https://github.com/tristanhimmelman/AlamofireObjectMapper.git', :branch => 'master'
#pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'master'
#pod 'AlamofireObjectMapper', :git => 'https://github.com/ozgur/AlamofireObjectMapper.git', :branch => 'master'
pod 'AlamofireObjectMapper', '> 6.2.0'> 5.2'
#pod 'AlamofireObjectMapper', '
#pod 'Alamofire', '~> 4.0.0'
@suryakantkachhi , did you try to change (response: DataResponse<LoginDSModel>)
to (response: AFDataResponse<LoginDSModel>)
?
_ = AF.request(URL, method: .get).responseObject { (response: AFDataResponse) in
let mappedObject = response.value
print(mappedObject?.location)
AlamofireObjectMapper-6.2.0.zip
see here
DataResponse<Any,AFError>
I am getting the same. What should I do?
This is how i made it to work.
Response is a struct to parse the response.
struct Response: Codable {
let test : String
}
static func getApiRequest(url:String, parameters:Dictionary<String, Any>,completion:@escaping (AFResult<Response>)->Void) {
let headers = configureCurrentSession()
AF.request(url,method: .get, encoding : JSONEncoding.default,headers:headers).responseDecodable { (response: AFDataResponse<Response>) in
completion(response.result)
return
}
}
Please @tristanhimmelman, update the README.md inserting the latest versions for Carthage and Cocoa. I spent hours trying to solve the incompatibility issue of AFDataResponse<T>
as parameter of responseObject {...}
.
I tried all of the mentioned approaches but nothing worked for me.