AlamofireObjectMapper icon indicating copy to clipboard operation
AlamofireObjectMapper copied to clipboard

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

Open TrabelsiAchraf opened this issue 5 years ago • 25 comments

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

TrabelsiAchraf avatar Jan 04 '20 03:01 TrabelsiAchraf

the same problem

JasonMR7 avatar Jan 07 '20 08:01 JasonMR7

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

o15a3d4l11s2 avatar Jan 09 '20 07:01 o15a3d4l11s2

Hello @TrabelsiAchraf What AlamofireObjectMapper version are you using?

RomanPodymov avatar Jan 19 '20 15:01 RomanPodymov

@RomanPodymov Version 5.2

TrabelsiAchraf avatar Jan 19 '20 18:01 TrabelsiAchraf

@TrabelsiAchraf What about v.5.2.1?

RomanPodymov avatar Jan 19 '20 19:01 RomanPodymov

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

o15a3d4l11s2 avatar Jan 20 '20 15:01 o15a3d4l11s2

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

RomanPodymov avatar Jan 20 '20 20:01 RomanPodymov

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

TrabelsiAchraf avatar Jan 24 '20 15:01 TrabelsiAchraf

Hello @TrabelsiAchraf And what ObjectMapper version are you using?

RomanPodymov avatar Jan 31 '20 14:01 RomanPodymov

The same. Alamofire 4.9.1, ObjectMapper 3.5.0, AlamofireObjectMapper 5.2.1

epitonium avatar Feb 04 '20 13:02 epitonium

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

RomanPodymov avatar Feb 04 '20 14:02 RomanPodymov

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

o15a3d4l11s2 avatar Feb 05 '20 13:02 o15a3d4l11s2

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?

RomanPodymov avatar Feb 05 '20 14:02 RomanPodymov

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

o15a3d4l11s2 avatar Feb 05 '20 15:02 o15a3d4l11s2

Thanks @o15a3d4l11s2 Could you please share it on GitHub?

RomanPodymov avatar Feb 05 '20 15:02 RomanPodymov

Thanks @o15a3d4l11s2 Could you please share it on GitHub?

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

o15a3d4l11s2 avatar Feb 05 '20 15:02 o15a3d4l11s2

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

RomanPodymov avatar Feb 05 '20 16:02 RomanPodymov

@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

  • Ambiguous use of 'map(JSONObject:)' I used to Xcode 11.3.1, swift 5 Can you support me Thank!

dodangduong avatar Feb 06 '20 10:02 dodangduong

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.

RomanPodymov avatar Feb 06 '20 11:02 RomanPodymov

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:)'.

dodangduong avatar Feb 07 '20 03:02 dodangduong

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

RomanPodymov avatar Feb 07 '20 08:02 RomanPodymov

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)

thongdn-it avatar Apr 02 '20 18:04 thongdn-it

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

o15a3d4l11s2 avatar Apr 02 '20 18:04 o15a3d4l11s2

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

thuythuyntt avatar Jun 19 '20 02:06 thuythuyntt

Hello @thuythuyntt Could you please share your Podfile?

RomanPodymov avatar Jun 19 '20 08:06 RomanPodymov