Flash3001/Xamarin.Swift

Linking Error When Running on Device

bwalpoleuk opened this issue · 4 comments

Firstly let me say I can't be 100% sure that this issue is related to the Xamarin Swift4 packages but I'm not sure where else to go for help.

We are using the Xamarin Swift4 packages in conjunction with a Swift library that we have provided a binding for, everything is build fine but when we run the app on a device it crashes:

Termination Description: DYLD, Symbol not found: _$s15_ObjectiveCTypes01_A11CBridgeablePTl

I've attached the full crash report.

crash-report.txt

From what I understand of the error message we have some missing or conflicted assembly but I'm not sure of the best approach to debug it.

I've also included the contents of our packages.config so you can see the packages and versions we are using.

packages.txt

We are using Visual Studio for Mac 8.0.4.0 and XCode 10.1

Hey @bwalpoleuk, most likely your library was built using a different version of Xcode.

You can check that by opening the YOURLIBRARY-Swift.h file inside the framework and looking at the header, it says which version of Swift was used to compile. Then you can check your installed version by typing swift --version on your terminal (Swift 4.2.1 as it is the one that comes with Xcode 10.1).

If that is the case you have 2 options:
1 - Recompile your library using Xcode 10.1 and rebuild the binding.
2 - downgrade Xcode and the matching Swift packages on your Xamarin project.

Side note: You can remove all your Swift4 packages and replace with the https://www.nuget.org/packages/Xamarin.Swift/ as one of the benefits is that it does this exact check for you at compile time so you know beforehand if library and Xcode doesn't match.

@Flash3001 It appears to have been built using Swift 5

// Generated by Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)

Unfortunately its a 3rd party library so re-compiling it isn't an option.

It is even better, Swift 5 brings a lot of good changes. You can update your Xcode to 10.2 (or 10.2.1) and install the new Xamarin.Swift package (single package) - please be sure to test on iOS 11, if you only test on iOS 12.2 you can miss some issues.

Great! That fixed it, removing all the Swift 4 packages and installing the new single package https://www.nuget.org/packages/Xamarin.Swift/