tristanhimmelman/AlamofireObjectMapper

Generic type 'DataResponse' specialized with too few type parameters (got 1, but expected 2)

deezaster opened this issue · 14 comments

Versions i use:

AlamofireObjectMapper 6.1.0
ObjectMapper 3.5.1
Alamofire 5.0.0-rc.2

Problem with .responseArray:

      AF.request(getUrlAPI(.GetAllMembers, apiVersion: "v4"), parameters: self.apiParams)
         
         .responseArray{ (response: DataResponse<[MemberJSON]>) in    

Error:

image

Did you resolve this?

i have this problem too.

ozgur commented

This has been fixed in #288

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'
pod 'ObjectMapper', '
> 3.4'
#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'
#pod 'AlamofireObjectMapper', '
> 5.2'
#pod 'Alamofire', '~> 4.0.0'
Screenshot 2019-11-03 at 7 16 23 PM

@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)

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.