-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Unable to build iOS Binding Library wrapping iOS Framework Native Reference #8000
Comments
Update: Some further investigation unearths the 'ObjcBindingNativeFramework' build action, which does seem to change the build process (it attempts to zip the framework) but using this fails as well. Intermittently I see either the zip step errors with code 255, or a generic 'can't create a binding resource package' error.
OR
|
@rolfbjarne is this something you know more about? |
here have a example: |
Thanks xtuzy for reaching out! Your example is binding a static library (.a) however which is not what I am looking for... I have gotten that to work via some example projects I've found floating around in github. I need to bind an iOS framework which is stored as a folder and as far as I can tell has some custom steps associated to package/zip the framework contents. Right now, I am looking for some high-level signal that this is indeed possible. I have been digging into build diagnostics and the targets files and it looks like there is support for Frameworks (e.g. ObjcBindingNativeFramework) but I have not gotten things to work. I spent some time looking at the deltas between build diagnostics and artifacts of a successful Xamarin app build and a failed MAUI app build, I've made some slow progress but keep running into new walls. I think I can get the iOS Library Binding project to build correctly, comparing it with the output of the Xamarin iOS Binding project, but unfortunately not the MAUI app. |
Do you try not use MAUI app, try use net6-ios app to do? i found MAUI at Windows reference winodws native project have bug, it need reference by nuget -_- |
xtuzy, I don't quite follow "try not use MAUI app, try use net6-ios app to do?" Do you mean the target framework? I'm currently targetting net6.0-ios: |
This is a duplicate of xamarin/xamarin-macios#15289, so I'm closing this issue. |
Description
I am attempting to update a project from Xamarin.Forms to Maui, that uses a binding project to wrap an iOS .framework library. I am not able to reference my Xamarin iOS Binding library in the Maui App; I need to create a new iOS Binding Library that targets .NET 6 iOS. I have been having trouble referencing the iOS Binding Library from the Maui App.
I have created a minimal Objective-C Framework, and validated it by integrating it into a Xamarin binding project and Xamarin.Forms project, and it works as expected - I am able to call into the Objective-C iOS Framework code from the application C# code.
But, when I try to consume a .NET 6 iOS Binding Library that uses the same Objective-C iOS Framework, I am lost. Visual Studio 17.3.0 preview allows me to create an iOS Binding Library, but it does not allow me to add a Native Framework Reference (the project context UI exists but is a no-op when I click it). So, I have manually modifed the iOSBinding .csproj file to reference the iOS Framework similarly to how the Xamarin binding library (from attached 210383-testmauiframeworkbindingscsproj.txt):
This seems to work, in that I can (supposedly) successfully build this iOSBinding project But, I get linker errors when I try to build the Maui App. The Maui App references the iOSBinding project via (from attached 210309-testmauiappcsproj.txt):
<ProjectReference Include="..\TestMauiFrameworkBindings\TestMauiFrameworkBindings.csproj" />
When I build the Maui App I get the following build errors (from attached 210310-build.log):
Following the error "Build Action must be 'ObjcBindingNativeLibrary'" I've attempted to use ObjcBindingNativeLibrary in lieu of NativeReference in my .csproj:
<ObjcBindingNativeLibrary Include="Native References/TestFramework.framework"/>
But now when I build, the compiler simply can't seem to get access to the framework folder:
Error CS1566 Error reading resource 'TestFramework.framework' -- 'Access to the path 'C:\Users\...\FrameworkTest_ForGithub\TestMauiApp\TestMauiFrameworkBindings\Native References\TestFramework.framework' is denied.' TestMauiFrameworkBindings
I've verified the folder path is valid and done everything I can think of to ensure that the folder is accessible (modifying it's security, running VS as administrator, etc.). As far as I can tell the folder is identical to the Xamarin binding project one (I can even reference that one directly) but I still can't get the iOS Binding Library project built.
So, I'm not sure what the core issue is but it seems like the compiler can't access my native iOS framework library no matter what I do. Are iOS Binding Libraries for frameworks currently supported in .NET 6? Is there a canonical example I could reference that I haven't been able to find?
The attached zip contains:
TestFramework - output of simple Xcode framework
TestXamarinApp - Working Xamarin app referencing iOS Xamarin Binding Library
TestMauiApp - Unsuccessful attempt at recreating TestXamarinApp in MAUI
FrameworkTest_ForGithub.zip
Steps to Reproduce
Result:
Using NativeReference build action fails to embed the framework
Using ObjcBindingNativeLibrary build action causes compiler to fail to access framework
Version with bug
6.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
All iOS versions
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: