xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.45k stars 511 forks source link

Xamarin framework support for net8.0-ios? #20817

Closed ljzj2 closed 2 months ago

ljzj2 commented 3 months ago

I created net8.0-ios and Want to use GPUImage framework it is using objective-c. I can not compile it to net-ios-binding since there is too many errors. then I find that there is Xamarin.GPUImage is for xamarinios not netios please support it to net-ios

I want to use it for camera picking and edge detecting. you may say I should use VisionKit but it not support ios13. So I have to use this.

what I want to do is to take photos of ticket.

rolfbjarne commented 3 months ago

The Xamarin.GPUImage NuGet's source code is here: https://github.com/xamarin/XamarinComponents/tree/main/iOS/GPUImage

However, it's not a supported NuGet anymore (https://github.com/xamarin/XamarinComponents/blob/main/Support.md).

The solution is to bind the GPUImage library yourself.

Assuming this is the GPUImage you're talking about, you'll have to:

  1. Compile the library into an xcframework (not a static library as their documentation says).
  2. Create a new .NET iOS binding project for the xcframework. You can probably use the source code from above as a starting point.

If that doesn't work, please attach the complete binding project, and we'll have a look.

ljzj2 commented 3 months ago

@rolfbjarne thank you I am not mac developper so it may be difficult to me. Now I am Compile the library into an xcframework how to Compile the library into an xcframework?

I tried and compile libGPUImage.a but I do not know is it the right file. and do not know how to combine iphoneos and iphonesimulator

ljzj2 commented 3 months ago

GPUImage.zip this is the .afile libGPUImage.zip

rolfbjarne commented 2 months ago

Now I am Compile the library into an xcframework how to Compile the library into an xcframework?

Here's Apple's documentation about it: https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle

There are also numerous other guides online, here's one: https://medium.com/@mihail_salari/embracing-the-power-of-xcframeworks-a-comprehensive-guide-for-ios-developers-77fe192d47fe

ljzj2 commented 2 months ago

after 3 days of search I still has this error :cryptexDiskImage' is an unknown content type when I was creating the framework.

com.apple.platform.xros' is an unknown platform identifier

rolfbjarne commented 2 months ago

after 3 days of search I still has this error :cryptexDiskImage' is an unknown content type when I was creating the framework.

com.apple.platform.xros' is an unknown platform identifier

Can you explain exactly what you're doing?

ljzj2 commented 2 months ago

thank you for your help. 1.

xcodebuild archive 
    -project GPUImage.xcodeproj
    -scheme GPUImage
    -destination "generic/platform=iOS"
    -archivePath "archives/GPUImage"

2.

xcodebuild archive 
    -project GPUImage.xcodeproj
    -scheme GPUImage
    -destination "generic/platform=iOS Simulator"
    -archivePath "archivessimulator/GPUImage"

3.

xcodebuild -create-xcframework
    -archive archives/GPUImage.xcarchive -framework GPUImage.framework
    -archive archivessimulator/GPUImage.xcarchive -framework GPUImage.framework
    -output xcframeworks/GPUImage.xcframework

I execute the 3 commands then there is error.

I searched and find that may I need to change the xcode version?

rolfbjarne commented 2 months ago

That looks correct to me, although I'm no expert.

I searched and find that may I need to change the xcode version?

Maybe, which version are you using?

In any case, creating an xcframework is not something we're the best at helping with.

You'd be better off asking for help in Apple's Developer Forums or StackOverflow.

ljzj2 commented 2 months ago

I can not solve it and there is no response in the forums I think I have to give it up.