Upon updating my Xcode project to the current Swift syntax and using Xcode 8.1 GM, I'm getting the error "Module complied with Swift 3.0 cannot be imported in Swift 3.0.1"
I have tried toggling the Legacy Swift Language on and off
I have also tried going back to an earlier Xcode
Are you using Carthage ? Try adding a --no-use-binaries flag after carthage update.
carthage update --platform iOS --no-use-binaries
carthage update --platform iOS --no-use-binaries fixed the issue
I thought I had tried this, but I guess I didn't.
Thank you
Hello guys!
I've got the same error with Cocoapods. Do you have any suggestions how to fix that?
Thanks,
Ostap
How do we add --no-use-binaries for CI like buddy build ?
@bishalg I would suggest you to use carthage bootstrap for CI build. https://github.com/Carthage/Carthage/issues/1403
--no-use-binaries works just fine, but becomes toxic when another dependency relies on pulling down a prebuilt binary. See AliSoftware/Reusable#34
@papertigers @wongzigii Is there anything we can do at the SwiftyJSON level to fix this issue? Or is it using --no-use-binaries an appropriate workaround, which would make this issue resolved?
SwiftyJSON was being downloaded precompiled by Carthage. The precompiled version was with Swift 3.0. So compiler complains that for the version is not match.
I would suggest you guys to build Swift frameworks from code locally.
This is not a bug of SwiftyJSON, though. Instead, it is a limitation of Swift at this time until Swift's ABI get stable. 馃槃
@wongzigii Thanks for elaborating on this! It seems that it's a Carthage issue and not related to SwiftyJSON so I'm gonna go ahead and close this. Let me know if you need to reopen. Thanks!
It looks like the uploaded *.framework for the release was compiled with Swift 3.0, since I'm still getting the error while using Xcode 8.2 and using the prebuilt framework. Was this intentional?
@solidcell You can use the latest SwiftyJSON 3.1.4 while using Xcode 8.2 .FYI #764
@wongzigii I know the code itself is compatible with Swift 3.0.2, but I'm fairly certain that the uploaded binary for the 3.1.4 release was compiled with Swift 3.0. This means that you need to use --no-use-binaries with Carthage. Or, in my case, I forked the repo and uploaded a binary built with Swift 3.0.2 so that I could use Carthage without turning off prebuilt binaries.
Most helpful comment
Are you using Carthage ? Try adding a
--no-use-binariesflag aftercarthage update.