tristanhimmelman / AlamofireObjectMapper

An Alamofire extension which converts JSON response data into swift objects using ObjectMapper
MIT License
2.66k stars 476 forks source link

Ambiguous use of 'map(JSONObject:)' When migrating to swift 5 and using Xcode 11.2.1 #299

Open TrabelsiAchraf opened 4 years ago

TrabelsiAchraf commented 4 years ago

Having the issue bellow when migrating the project to Swift5 and using Xcode 11.2.1 : Ambiguous use of 'map(JSONObject:)'

Screenshot 2020-01-04 at 04 46 44
JasonMR7 commented 4 years ago

the same problem

o15a3d4l11s2 commented 4 years ago

@tristanhimmelman, do you have plans to resolve these error, or you prefer working on the new version with Alamofire 5?

RomanPodymov commented 4 years ago

Hello @TrabelsiAchraf What AlamofireObjectMapper version are you using?

TrabelsiAchraf commented 4 years ago

@RomanPodymov Version 5.2

RomanPodymov commented 4 years ago

@TrabelsiAchraf What about v.5.2.1?

o15a3d4l11s2 commented 4 years ago

@RomanPodymov I have used v5.2.1 prior to posting here and I get the same error.

RomanPodymov commented 4 years ago

@TrabelsiAchraf @o15a3d4l11s2 Cannot reproduce the issue on my side. Which Alamofire and ObjectMapper versions are you using? How do you install dependencies?

TrabelsiAchraf commented 4 years ago

@RomanPodymov I use the Alamofire 4.9.1 with AlamofireObjectMapper 5.2.1. And for dependencies I use cocoapods. Not working always.

RomanPodymov commented 4 years ago

Hello @TrabelsiAchraf And what ObjectMapper version are you using?

epitonium commented 4 years ago

The same. Alamofire 4.9.1, ObjectMapper 3.5.0, AlamofireObjectMapper 5.2.1

RomanPodymov commented 4 years ago

Hello @TrabelsiAchraf @epitonium @o15a3d4l11s2 @JasonMR7 Could you please share an example where I can reproduce the issue?

o15a3d4l11s2 commented 4 years ago

@RomanPodymov , I am using the following:

Error that I get:

Ambiguous use of 'map(JSONObject:)'

from AlamofireObjectMapper.swift, line 109 and

Ambiguous use of 'mapArray(JSONObject:)'

from AlamofireObjectMapper.swift, line 167

I explicitly set the Swift Language Version to v5 for AlamofireObjectMapper pod project. The reason is that I want all projects using Swift 5, so I no longer get the warning that there are projects to migrate to Swift 5.

Sorry for the late answer, I was pretty busy last week. Now I am able to answer faster.

RomanPodymov commented 4 years ago

Hello @o15a3d4l11s2 Thanks for the clarification. However, I still cannot reproduce the issue on my Mac. Could you please share a simple project that I can use to reproduce the issue?

o15a3d4l11s2 commented 4 years ago

This is just a dummy Single View project with the pods pre-installed and Swift version set to 5 in the AlamofireObjectMapper pod.

demo.zip

RomanPodymov commented 4 years ago

Thanks @o15a3d4l11s2 Could you please share it on GitHub?

o15a3d4l11s2 commented 4 years ago

Thanks @o15a3d4l11s2 Could you please share it on GitHub?

https://github.com/o15a3d4l11s2/AlamofireObjectMapper-issue299-demo

RomanPodymov commented 4 years ago

Fixed in #300, for now use pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'xcode-10-2-fix' in your Podfile.

dodangduong commented 4 years ago

@RomanPodymov , I am using the following:

  • Cocoapods for installing the libraries
  • Alamofire v4.9.1 (I do not want to use Alamofire v5 yet)
  • AlamofireObjectMapper v5.2.1 (because of Alamofire v4 support)
  • ObjectMapper v3.5.1
  • Xcode v11.3.1
  • Swift Language Version v5

Error that I get:

Ambiguous use of 'map(JSONObject:)'

from AlamofireObjectMapper.swift, line 109 and

Ambiguous use of 'mapArray(JSONObject:)'

from AlamofireObjectMapper.swift, line 167

I explicitly set the Swift Language Version to v5 for AlamofireObjectMapper pod project. The reason is that I want all projects using Swift 5, so I no longer get the warning that there are projects to migrate to Swift 5.

Sorry for the late answer, I was pretty busy last week. Now I am able to answer faster.

Hi, I used to pod 'AlamofireObjectMapper', '5.2.1' but I still got an error

RomanPodymov commented 4 years ago

Hello @dodangduong As I already mentioned, replace pod 'AlamofireObjectMapper', '5.2.1' with pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'xcode-10-2-fix' in your Podfile.

dodangduong commented 4 years ago

Hello @dodangduong As I already mentioned, replace pod 'AlamofireObjectMapper', '5.2.1' with pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'xcode-10-2-fix' in your Podfile.

If my project used swift 4.2 it's work but I set my project is swift 5 I still got an error Ambiguous use of 'map(JSONObject:)'.

RomanPodymov commented 4 years ago

Hello @dodangduong Could you please share on GitHub a project where I can reproduce the issue that you have?

thongdn-it commented 4 years ago

Hi @dodangduong You can try to replace pod 'AlamofireObjectMapper', '5.2.1' with pod 'AlamofireObjectMapper', git:'https://github.com/thongdn-it/AlamofireObjectMapper.git'

I tried in my project and it works

Alamofire (5.0.5) AlamofireImage (4.0.3) AlamofireObjectMapper (6.3.0)

o15a3d4l11s2 commented 4 years ago

@thongdn-it, this specific issue is for an older version of AlamofireObjectMapper that is used in conjunction with Alamofire 4.

thuythuyntt commented 4 years ago

@RomanPodymov , I am using the following:

  • Cocoapods for installing the libraries
  • Alamofire v4.9.1 (I do not want to use Alamofire v5 yet)
  • AlamofireObjectMapper v5.2.1 (because of Alamofire v4 support)
  • ObjectMapper v3.5.1
  • Xcode v11.3.1
  • Swift Language Version v5

Error that I get:

Ambiguous use of 'map(JSONObject:)'

from AlamofireObjectMapper.swift, line 109 and

Ambiguous use of 'mapArray(JSONObject:)'

from AlamofireObjectMapper.swift, line 167

I explicitly set the Swift Language Version to v5 for AlamofireObjectMapper pod project. The reason is that I want all projects using Swift 5, so I no longer get the warning that there are projects to migrate to Swift 5.

Sorry for the late answer, I was pretty busy last week. Now I am able to answer faster.

I am having the same problem. Did you find a solution?

RomanPodymov commented 4 years ago

Hello @thuythuyntt Could you please share your Podfile?