Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TrabelsiAchraf opened this issue Jan 4, 2020 · 25 comments

Comments

@TrabelsiAchraf
Copy link

TrabelsiAchraf commented Jan 4, 2020

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 TrabelsiAchraf changed the title Ambiguous use of 'map(JSONObject:)' When using Xcode 11.2.1 Ambiguous use of 'map(JSONObject:)' When migrating to swift 5 and using Xcode 11.2.1 Jan 4, 2020
@JasonMR7
Copy link

JasonMR7 commented Jan 7, 2020

the same problem

@o15a3d4l11s2
Copy link

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

@RomanPodymov
Copy link
Contributor

Hello @TrabelsiAchraf
What AlamofireObjectMapper version are you using?

@TrabelsiAchraf
Copy link
Author

@RomanPodymov Version 5.2

@RomanPodymov
Copy link
Contributor

@TrabelsiAchraf What about v.5.2.1?

@o15a3d4l11s2
Copy link

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

@RomanPodymov
Copy link
Contributor

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

JeanCharlesNeboit pushed a commit to openium/AlamofireObjectMapper that referenced this issue Jan 22, 2020
@TrabelsiAchraf
Copy link
Author

TrabelsiAchraf commented Jan 24, 2020

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

@RomanPodymov
Copy link
Contributor

Hello @TrabelsiAchraf
And what ObjectMapper version are you using?

@epitonium
Copy link

epitonium commented Feb 4, 2020

The same. Alamofire 4.9.1, ObjectMapper 3.5.0, AlamofireObjectMapper 5.2.1

@RomanPodymov
Copy link
Contributor

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

@o15a3d4l11s2
Copy link

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

@RomanPodymov
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

Thanks @o15a3d4l11s2
Could you please share it on GitHub?

@o15a3d4l11s2
Copy link

Thanks @o15a3d4l11s2
Could you please share it on GitHub?

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

@RomanPodymov
Copy link
Contributor

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

@dodangduong
Copy link

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

@RomanPodymov
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

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

@thongdn-it
Copy link

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
Copy link

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

@thuythuyntt
Copy link

@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
Copy link
Contributor

Hello @thuythuyntt
Could you please share your Podfile?

brow added a commit to newcompute-ai/AlamofireObjectMapper that referenced this issue Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants