Share via

Library binding issue

Eliseo Gamba 21 Reputation points
2023-10-09T16:53:17.3066667+00:00

Hello everyone,

I'm having problems with a native library and Firebase. I can't share the library due to confidentiality issues, but it's an iOS binding library.

The problem arises when both libraries coexist in the project. If they are separate, both work fine.

The Firebase library I am using is Firebase.iOS.CloudMessaging.

When I install it, there are many missing errors during native reference compilation of libswiftCore.dylb.

This can be corrected with the following, which I've seen in other forums:

<Target Name="CreateMtouchExtraArgs" AfterTargets="_DetectSdkLocations">      
	<PropertyGroup>         
		<MtouchExtraArgs>$(MtouchExtraArgs) -v -v -v -v -gcc_flags "-L /usr/lib/swift -L $(_SdkDevPath)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos"</MtouchExtraArgs>         
		<_BundlerArguments Condition="'$(_PlatformName)' != 'macOS'">$(MtouchExtraArgs)</_BundlerArguments>     
	</PropertyGroup>     
	<Message Importance="high" Text="MtouchExtraArgs is $(MtouchExtraArgs)" />  
</Target>

With this, the app compiles, but when debugging the app crashes as soon as it opens. Looking at the analytics on the device, it says it can't find the libswiftCore.dlyb library. I fixed this problem by installing the Xamarin.Swift nuget which includes the necessary libraries, but the app still crashes with the following error:

"This copy of libswiftCore.dylib requires an OS version prior to 12.2.0."

Any ideas?

Developer technologies | .NET | Xamarin
0 comments No comments

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 84,086 Reputation points
    2023-10-09T17:41:11.6266667+00:00

    The library requirement means the code was written in swift and distributed as a static library so objective-c could call it (and Xamarin/maui only support objective-c calls).

    the error is usually caused by the wrong search path, so the wrong version of libswiftCore.dylib Is used.

    this issue has happened in previous Xamarin versions

    https://github.com/xamarin/xamarin-macios/issues/5816#issuecomment-477733801

    you may need to open an issue.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.