-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ios binding library with xcframework/framework cannot be referenced in the main .NET MAUI project #21189
Comments
This is a known issue (#10148). It's only intellisense that doesn't work, if you build the project, it'll build just fine. Referencing the binding project directly, something like this from your main project, should work though: <ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'ios' ">
<Reference Include="../MauiDemoApp.Binding.iOS/bin/Debug/net8.0-ios/Com.SAS.CI360.dll" />
</ItemGroup> Note that in this case you'll have to build the binding project manually first, it won't be built automatically when you're building the main project. Additionally, in your binding project, you should reference the .xcframework (and not the .framework inside the .xcframework): <NativeReference Include="SASCollector.xcframework"> Can you try that and see if it works for you? |
I tried, and the project ran without errors. However, even though the native methods' corresponding C# methods were called, there was no effect. It seemed that the native code was not invoked. Is there still something missing in my project? Do I need to add LinkWith in ApiDefinition.cs? The ApiDefinition.cs and StructsAndEnums.cs were copied from a previous Xamarin project. The Xamarin project worked without any issue. |
Can you update your GitHub project with exactly what you did? |
I already updated my Github project, with the exception of a plist file that is not essential to test. This line "SASLogger.SetLevel(SASLoggerLevel.All);" in AppDelegate.cs should provide logs such as: INFO:..., DEBUG:... I also changed xcframework to framework, because if I run with xcframework it will complain that I cannot do it on a simulator. So I get out the framework from xcframework that is for a simulator. |
I get this message:
Note that some types of messages from native code might not show up in the IDE (ref #21180), so you might have to use the iOS Device Log to see them (https://support.apple.com/en-in/guide/console/cnsl1012/mac) Can you do that and check if you see anything? |
I got the same warning. That is from the native library. So that confirms there is still log. It's just that I wasn't expect to see this. The reason that I got this warning even though I have the plist file is because the native library didn't find it. This is what I added in csproj file:
Is it correct? |
Where is this plist supposed to be located in the app bundle? In the root directory? |
In native app, it should be in the main bundle. Anywhere in the native app is fine because all files in different folders are flattened in one place. |
Try this: <ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'iOS' ">
<BundleResource Include="./Platforms/iOS/SASCollector.plist" Link="SASCollector.plist" />
</ItemGroup> |
Adding "Link" attribute solved the problem. Thank you very much @rolfbjarne |
This might also have worked if you put the SASCollector.plist in the In any case, I'm glad it's working for you now. |
I seem to have similars issues both with BranchSDK and AppsFlyerSDK when building with an Intel (amd no problem).
@rolfbjarne do you have any idea what I could do about that? |
Apple platform
iOS
Framework version
net8.0-*
Affected platform version
.NET6, .NET7, .NET8
Description
I created an iOS binding project with iOS xcframework (I also tried framework). The project built without any errors. I conditionally (iOS) referenced the binding project in my main project. But the namespace and the classes that were generated in the binding project's obj/Debug/net8/0-ios/iOS. I tried different ways to reference the binding project in the main project like these:
..\MauiDemoApp.Binding.iOS\bin\debug\net8.0-ios\MauiDemoApp.Binding.iOS.dll
or:
But when I tried referencing the namespace and the classes in the main project's Platforms/iOS/AppDelegate.cs, they were not recognized.
I created a GitHub repo for this: https://github.com/wwen0/MauiDebug
Steps to Reproduce
Did you find any workaround?
No response
Build logs
No response
The text was updated successfully, but these errors were encountered: