Is Mapbox Navigation compatible with Swift 5.0 - ios

Can anyone confirm that Mapbox Navigation works with Swift 5.0 or for that matter they are still a going concern? I have now tried building the frameworks in Carthage using Xcode 11.3 and a fresh install of Xcode 11.6 on a brand new Mac running the latest OS and in both cases when trying to import framework:
Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.2.4 compiler:
According to some answers to this SO question, this happens when Developer has not yet released their app for Swift 5, although the Mapbox changelog claims they have
Have tried contacting Mapbox through every conceivable channel and radio silence. Hopefully they are still in business and supporting the software but I'm not sure.

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.1.3
compiler:
/Users/M/Desktop/War/idaru/MapboxCoreNavigation.framework/Modules/MapboxCoreNavigation.swiftmodule/arm64.swiftmodule
This error appears because you still have a built copy of MapboxCoreNavigation on your system and Xcode is linking against it instead of building from scratch. It’s always necessary to do a clean build when upgrading Xcode.
If you encounter this error message within Xcode when building your application target, please clean your build products using Product ‣ Clean Build Folder and build again. If you're seeing this error on the command line when running carthage update, you can try cleaning your Carthage caches using the following command:
rm -rf ~/Library/Caches/carthage/ ~/Library/Caches/org.carthage.CarthageKit/binaries/

Related

Building old version of React-Native app with Xcode 11

I just started working on an already existing React-Native app that needs a really small update, but that has not been updated since October 2019.
The first thing I need, in order to start updating it, is to build the app. That is where I cannot find a way to do it.
At the moment, I’m trying to build the app only on iOS and not on Android.
First of all the current toolset versions I’m using are:
React-Native version: 0.53.3
Xcode version: 11.4.1
iOS SDK: 13.4
Node version: 8.16.6
NPM version: 6.14.1
I initially had problem with third-party tools, but I managed to fix it through manually installing them in the node-modules/react-native folder.
Now I’m getting errors about Xcode not finding headers of the modules the app is using
like, for example,
React/RCTViewManager.h file not found
Or, similarly, the GoogleSignIn.h headers in the RNGoogleSignIn module
I believe it’s just an error of how libraries are imported in Xcode, because as a test I have created a new react-native “test app” with the same exact versions of react-native and node, then I installed the core dependencies needed to perform the update on the original app, and I managed to build it without problems.
I’ve also tested building the app on an old Mac with macOS 10.14, using Xcode 9, but I’ve got different errors, always related to importing headers of modules.
This is the toolkits versions of the “old Mac”:
React-Native version: 0.53.3
Xcode version: 9.4.1
iOS SDK: 11.3
Node version: 8.16.6
NPM version: 6.14.1
Searching online I know that some of the problems I have faced (like the third-party react-native manual install) have been fixed in react-native updates, but I’m not expert enough with the technology to be sure that I can handle the update process without introducing bugs. I would prefer to just make this version run for now and facing the updating process later.
Do you have any suggestion of things about what I can do in order to successfully build the app?

If anyone ever comes here with a similar problem: the solution was pretty simple.
Be sure you're using the .xcworkspace file in your iOS folder, and not the .xcodeproj. This is used to automatically (and correctly) load the Pods dependencies in Xcode without having to manually link them.
Be sure that you installed the dependencies correctly with the right version of Cocoapods. We had to use an old version (1.5.x) that would automatically downloaded some pod dependencies. Our error was due to Facebook SDK. Newer versions of cocoapods did not download it, while the 1.5.x version would download it.

Swift Module is compiled in version 4.2.1 instead of 5.0.1

I have a Swift Module that was fully migrated to Swift 5 using XCode version 10.2.1. When I 'distribute' the Module internally, I have no issues when integrating. When I distribute (using XCode's Organizer) the Module to another developer, they see the following error:
Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0.1
My internal applications all use Swift 5 as the build language. My XCode command line tools are version 10.2.1.
The other developer is also using Swift 5 with XCode 10.2.1.
What do I need to do to make my Module compile appropriately?
In most cases, this happens because the swift version of the module is not set correctly.
Before building the module, check the swift version of the module in Build Settings/Swift Language Version.
How is your module imported into your Xcode project? Are you using Carthage or Pod by any chance? If so, make sure your Terminal is pointing to the right XCode version prior to importing and installing your package locally via carthage or pod install.
Open a Terminal and check the selected XCode version:
/usr/bin/xcodebuild -version
If this is not the same version of XCode, make sure to point to the your current XCode app binary
sudo xcode-select -switch PATH_TO_YOUR_XCODE.APP
Import your package via carthage/pod, go back to your project in xcode, clean and build.

Xcode version creating AudioKit import problems

After a recent Xcode version install (10.2) my AudioKit import statements don't work
"Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler: ".
I have thus far always used cocoa pods to install AudioKit.
Is the best thing to do here to revert Xcode and wait a while for the 5.0 version?
We just pushed a pre-release pod (version 4.6.4.b1) compiled with Swift 5 on Xcode 10.2. You can use it by following the instructions on this page:
https://github.com/AudioKit/Specs
You can use that one until the next mainstream release compiled with Xcode 10.2 is pushed out, hopefully in the coming days.
Rather than reverting Xcode, downloading and installing the 10.1 toolchain from https://swift.org/builds/swift-4.2.3-release/xcode/swift-4.2.3-RELEASE/swift-4.2.3-RELEASE-osx.pkg
then setting Xcode | Toolchains to use the Swift 4.2.3 Release allows me to keep running the existing code until Swift 5 build issues are resolved.
Alternatively use the recently pushed working staging pod. Its version number is 4.6.4.b1 - instructions are here: https://github.com/AudioKit/Specs

Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler

Short story: Xcode 10 is set to Swift 4, but it is using Swift 4.2.
Long story: Our project is not ready for Swift 4.2, since our dependent frameworks are not Swift 4.2, yet. But, I would like to, at least, use Xcode 10.
I have Xcode 9.4.1 and Xcode 10 installed.
I have Command Line Tools set to use Xcode 9.4.1:
In Xcode 10, I have the project setting, Swift Language Version, set to
Swift 4.
I have verified on the command line the Swift version the shell is
using is 4.1.2:
"swift --version Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)"
I've run carthage update.
I've quit Xcode 10 and relaunched.
I have deep cleaned and deleted Derived Data.
I build and I get this error:
"Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2
compiler:
.../App/Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule"
To me, this indicates that I have my intended Swift version (4.1.2) set correctly and Xcode is still trying to use the wrong version of Swift (4.2).
Does anyone have suggestions on how to resolve this? Am I missing something? Xcode bug?
I'm not positive, but my guess is that this is the reason:
I have Command Line Tools set to use Xcode 9.4.1
You have to recompile your Swift 4 dependencies using Xcode 10, because Swift is not ABI-stable, i.e. binaries compiled with different compiler versions are not compatible. And even Swift 4.0 binaries compiled with different versions of Xcode may not be compatible.
I don't have much experience with Carthage, but my guess is that you should use Xcode 10 as a command-line tool, but you have to set a different Swift language version to be used by Xcode 10. It should probably be specified in the project (in this case RealmSwift), or using environment variables, but you'll need someone else to answer with more details, I'm afraid.
Using Realm with Xcode 10 requires building it from source. In Terminal write:
git clone --recursive https://github.com/realm/realm-cocoa.git
cd realm-cocoa
sh build.sh ios-swift
you can use multiple swift toolchains. download url swift toolchain download after you install some version. restart your xcode, in xocde menu you can see toolchains option.
I had the same problem and then I realised I had not selected Xcode 10 as my Xcode. Try:
sudo xcode-select -s /Applications/Xcode10.app
Also, if you will be switching between Xcode9 and 10, I recommend you the following: If you change from 9 to 10, run mv Carthage Carthage9 and then rebuild Carthage. Whenever you want to switch back, move Carthage to Carthage10 and do mv Carthage9 Carthage. This will save you lots of time building.

Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1

However I have recompiled the framework using the same Xcode and it still gives me this error.
Base SDK iOS 11.1 for both
Swift Language Version Swift 4.0 for both
Not using Pods/Carthage
I hope someone might know
Update:
For release versions of Xcode:
This error (and similar errors involving Swift 4.1, 4.2, etc.) will occur when opening a project with Xcode 9.1, 9.2, 9.3, 9.4, 10, etc. that uses frameworks that were built with earlier Xcode tools.
To fix the issue, update and rebuild your frameworks using Carthage ( carthage update --platform iOS), Cocoapods (pod update or pod install), or manually, with the new updated Xcode tools. The tools should be updated automatically when you update Xcode, but if not, you can follow the steps outlined below in the original answer.
You may also need to clean your project cmd + shift + k and possibly your build folder cmd + option + shift + k to get Xcode to not use cached framework builds.
In some cases you may also need to delete your derived data folder (Easily found by going to Xcode Preferences -> Locations -> Derived Data Folder
(Thanks Stunner)
For beta versions of Xcode:
See original answer below and then follow steps above.
Original Answer:
You probably still have your xcodebuild tools set to Xcode 9.0 which builds with Swift 4.0 and is incompatible with Xcode 9.1 beta's Swift 4.0.1.
Check in the terminal using the command:
xcodebuild -version
Or just go into Xcode preferences -> Locations and check/change the command line tools to Xcode 9.1. You should be set then.
My issue was due to an external framework not being compiled for Swift 4.0.2. I had added this file via Carthage, so running:
carthage update --platform iOS
And then cleaning the project cmd + shift + k and build folder cmd + option + shift + k and deleting the derived data folder (merely moving it to trash works as well) worked for me.
In my case, I downloaded xCode 11 Beta version to test SwiftUI. When i run my project, i got "Module compiled with Swift 5.1 cannot be imported by the Swift 5.0.1 compiler:..." error.
To do fix this issue. i changed xCode command line tool to new xCode 11 comment line tool. After that, you can create new xcode project with SwiftUI.
Xcode -> Preferences -> Location -> XCode command Line Tool
i hope, this will help someone who want to test with new freamework :)
Install Xcode Toolchain of specific Xcode version which was working for you from here.
An Xcode toolchain includes a copy of the compiler, lldb, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift.
Open Xcode's Preferences, navigate to Components > Toolchains , and select the installed Swift toolchain.
This will let you compile and run the app for now.
I hit this issue with Xcode 10 beta, which adds Swift 4.2. My issue was unrelated to Carthage or any external dependencies.
Go to YourTarget > Build Settings > Swift Language Version for all of your Xcode targets.
Mine were all set to Swift 4.
After adding a Copy Files Build Phase, I started getting the error
:0: error: module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler: /Users/user/Library/Developer/Xcode/DerivedData/MyApp-faskfrihumfcdibjxisjvbfshppp/Build/Intermediates.noindex/MyApp.build/Debug/MyAppExtension.build/Objects-normal/x86_64/MyClass~partial.swiftmodule
Command MergeSwiftModule failed with a nonzero exit code
I then set each target's Swift Language Version to Swift 4.2, which eliminated the error.
I'm not sure why the error was occuring in the first place, though, as having all targets set to Swift 4 should be equally as valid.
In my case (Xcode 9.2):
I went to Xcode Preferences > Locations > Derived Data
I then deleted the data and did a clean build and was ok.
In my case, I used CocoaPods with plugin cocoapods-binary to prebuild libraries to binaries. After I upgrade Xcode from 10 to 11, Xcode gives me this error:
Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler
I fix it by removing the /Pods directory and running pod install.
In my case, I re-compiled the framework with whatever version it was complaining about.
To recompile, run pod update or update the carthage (which ever one you're using), and build the project.
Then search for the framework in finder. Copy-paste the theFramework.framework to your project and make sure to "Copy items if needed."Build the project again and it should work.

Resources