Open croyneaus4u opened 6 years ago
Have you guys managed to fix these warnings? I have a similar problem
I believe that the implicitly unwrapped optional methods that are getting the warnings can be simply removed. They seem to all be identical to the plain unwrapped optional methods and as long as the compiler is going to use the plain unwrapped optional methods even for implicitly unwrapped parameters everything should 'just work' without the implicitly unwrapped optional methods.
Hey all, came here to post this after I resolved all the warnings.
For me, removing all of the explicit unwrapping conflicts (e.g. param is T!
version, not the optional T?
) was the solution. This ObjectMapper project should be updated accordingly for Swift 4.1 as we can no longer build against 4.0 in Xcode 9.3. Leaving the methods with the optional params seemed the safest way to go, and sure enough the entire project runs just fine.
edit: really just reiterating what phoney said above.
You'll also need to update from flatMap
-> compactMap
.
You won't see these warnings against the Swift 4.0 toolchain fwiw, but that's not app-store compat.
Hm... I've tried this but for some reason the compiler chooses the T
overload instead of T?
for my T!
arguments :( This breaks things for me :(
To be more explicit if I have these methods:
func <-(param: T) -> T { }
func <-(param: T?) -> T? { }
func <-(param: T!) -> T! { }
Removing func <-(param: T!) -> T! { }
seems to have the compiler use func <-(param: T) -> T { }
for T!
parameters instead of func <-(param: T?) -> T? { }
:(
@zeusent Couple questions: Are you using the latest Xcode compiler? When you say you have a similar problem are you referring to your use of ObjectMapper or something else?
Yes, I have the latest Xcode version. And I’ve been looking all over the swift docs to find an explanation of this new warning that’s being triggered in Swift 4.1 and a recommended way of fixing it but couldn’t find any. My problem was not related to this project but some code of mine and this was the only place where I could find a similar problem. I’m sorry for “hijacking” the thread I guess just thought that sharing some info might help us all :-/
There's some discussion of this issue https://bugs.swift.org/browse/SR-6690 and https://bugs.swift.org/browse/SR-637 I think your case may be related to the return type of the functions (but I'm not sure).
Looks like this issue is resolved in Xcode 9.3.1
This is issue is not resolved in Xcode 9.3.1
When I tried to remove the T!
& [T]!
overloads. I get error saying:
Binary operator '<<-' cannot be applied to operands of type 'TopTitleHeader!' and '[String : Any]?' where
class TopTitleHeader: Codable
Not working even in X-Code 9.3.1
cocoapods version is 3.2, can update fast?
Updating to the latest version of ObjectMapper(3.2) and purging the Xcode derived data through the following command fixes the problem.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Doesn't seem fixed to me. I'm using Xcode 9.4.1 and pod version 3.3 and I see the warnings. Looking at the code I see checks for swift >= 4.1.5 and the swift version in this Xcode is 4.1.2.
I guess what was done was to prevent the compiler errors on swift 4.2 but leave the warnings in 4.1.
I would have preferred removing the warnings in swift 4.1. While this is a potentially breaking change users could choose to stay on an older version of the pod until they fix their code, which they'll have to do for swift 4.2 anyway.
When I change all those checks to swift >= 4.1 my code compiles without warnings and runs normally.
@phoney The new release did not fix those warnings because IUO does not have the same behavior in Swift 4.1 compiler. This causes compilation errors in test targets of the library. #980
For me this issue is still not resolved. I am using Xcode 9.4.1 and Swift 4.1 for my project. After applying for solution given from @chrisblessing it doesn't seem to work. Also as @phoney said there are some checks for >=4.1 In my project its not there.
My Xocde is 9.4.1
Project Swift Version 4.1
Pod ObjectMapper Target Version -> 3.3
ObjectMapper Version -> 5.0
Still warnings are coming up.
It would be great if fellow developers can help me I have been stuck at this issue for weeks.
Getting the above and similar warnings when trying to build for Swift4.1. It seems this type of overloading has been deprecated 4.1 onwards. Getting the below message for deprecation:
Overloading by kind of optional is deprecated and will be removed in a future release
I am using X-Code 9.3