AlamofireObjectMapper
AlamofireObjectMapper copied to clipboard
Ambiguous use of 'map(JSONObject:)' When migrating to swift 5 and using Xcode 11.2.1
Having the issue bellow when migrating the project to Swift5 and using Xcode 11.2.1 : Ambiguous use of 'map(JSONObject:)'
the same problem
@tristanhimmelman, do you have plans to resolve these error, or you prefer working on the new version with Alamofire 5?
Hello @TrabelsiAchraf What AlamofireObjectMapper version are you using?
@RomanPodymov Version 5.2
@TrabelsiAchraf What about v.5.2.1?
@RomanPodymov I have used v5.2.1 prior to posting here and I get the same error.
@TrabelsiAchraf @o15a3d4l11s2 Cannot reproduce the issue on my side. Which Alamofire and ObjectMapper versions are you using? How do you install dependencies?
@RomanPodymov I use the Alamofire 4.9.1 with AlamofireObjectMapper 5.2.1. And for dependencies I use cocoapods. Not working always.
Hello @TrabelsiAchraf And what ObjectMapper version are you using?
The same. Alamofire 4.9.1, ObjectMapper 3.5.0, AlamofireObjectMapper 5.2.1
Hello @TrabelsiAchraf @epitonium @o15a3d4l11s2 @JasonMR7 Could you please share an example where I can reproduce the issue?
@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.
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?
This is just a dummy Single View project with the pods pre-installed and Swift version set to 5 in the AlamofireObjectMapper pod.
Thanks @o15a3d4l11s2 Could you please share it on GitHub?
Thanks @o15a3d4l11s2 Could you please share it on GitHub?
https://github.com/o15a3d4l11s2/AlamofireObjectMapper-issue299-demo
Fixed in #300, for now use pod 'AlamofireObjectMapper', :git => 'https://github.com/RomanPodymov/AlamofireObjectMapper.git', :branch => 'xcode-10-2-fix' in your Podfile.
@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 andAmbiguous use of 'mapArray(JSONObject:)'
from
AlamofireObjectMapper.swift, line 167I 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!
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.
Hello @dodangduong As I already mentioned, replace
pod 'AlamofireObjectMapper', '5.2.1'withpod '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:)'.
Hello @dodangduong Could you please share on GitHub a project where I can reproduce the issue that you have?
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, this specific issue is for an older version of AlamofireObjectMapper that is used in conjunction with Alamofire 4.
@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 andAmbiguous use of 'mapArray(JSONObject:)'
from
AlamofireObjectMapper.swift, line 167I 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?
Hello @thuythuyntt Could you please share your Podfile?