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.46k stars 511 forks source link

Multiple binding signature issues with AVAssetWriter related types #21509

Open jeremy-visionaid opened 2 hours ago

jeremy-visionaid commented 2 hours ago

Apple platform

iOS, Mac Catalyst

Framework version

net8.0-, net9.0-

Affected platform version

.NET 8.0.403

Description

public AVAssetWriter(NSUrl outputUrl, string outputFileType, out NSError error);

Should be

public AVAssetWriter(NSUrl outputUrl, AVFileTypes outputFileType, out NSError error);

Or the enum's FieldAttribute value should be conventiently accessible as a string somewhere

Similarly, AVAssetWriterInput exposes all the MediaTypes as a string instead of a AVMediaTypes enum and there appears to be no convenient alternative.

Steps to Reproduce

Can just look at the docs:

AVAssetWriter:

https://developer.apple.com/documentation/avfoundation/avassetwriter/1426663-assetwriterwithurl?language=objc

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avassetwriter.-ctor?view=xamarin-ios-sdk-12#avfoundation-avassetwriter-ctor(foundation-nsurl-system-string-foundation-nserror@)

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avfiletypes?view=xamarin-ios-sdk-12

AVAssetWriterInput:

https://developer.apple.com/documentation/avfoundation/avassetwriterinput/1385912-initwithmediatype?language=objc

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avassetwriterinput.-ctor?view=xamarin-ios-sdk-12#avfoundation-avassetwriterinput-ctor(system-string-avfoundation-audiosettings)

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avmediatypes?view=xamarin-ios-sdk-12

Did you find any workaround?

Check the Apple docs and/or grep the xamarin-macios repo for the field values you actually want and define a class that exposes the strings instead of using the enums from the bindings.

Relevant log output

No response

jeremy-visionaid commented 2 hours ago

@rolfbjarne I think this type of issue has come up before (i.e. mismatched strings/enums), and it probably isn't limited to these particular types, just these are the ones that have come up most recently.

Unfortunately, I also can't link to the current documentation due to https://github.com/dotnet/dotnet-api-docs/issues/10178