Skip to content

Carplay - CPGridButton bindings #24491

@dartasen

Description

@dartasen

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

.NET 9, ios workload : 9.0.308.2

Description

While upgrading xcode 26.0 on my .NET 9 application, I noticed a warning in my CarPlay app.

Apple introduced https://developer.apple.com/documentation/carplay/cpgridbutton/init(titlevariants:image:messageconfiguration:handler:)?language=objc in addition to the existing https://developer.apple.com/documentation/carplay/cpgridbutton/init(titlevariants:image:handler:)?language=objc

However I don't see any Obsolete on the apple documentation, that would justify to reflect in the .NET bindings

[Export("initWithTitleVariants:image:handler:")]
[ObsoletedOSPlatform("ios26.0", "Use 'Constructor (string[], UIImage, CPMessageGridItemConfiguration, Action<CPGridButton>)' instead.")]
[SupportedOSPlatform("ios")]
public CPGridButton(string[] titleVariants, UIImage image, [BlockProxy(typeof(NIDActionArity1V34))] Action<CPGridButton>? handler);

[DesignatedInitializer]
[Export("initWithTitleVariants:image:messageConfiguration:handler:")]
[SupportedOSPlatform("ios26.0")]
public CPGridButton(string[] titleVariants, UIImage image, CPMessageGridItemConfiguration? messageConfiguration, [BlockProxy(typeof(NIDActionArity1V34))] Action<CPGridButton>? handler);

I guess it's related by it's also producing a warning :
Image
I can wrap it inside a pragma warning disable, but am I doing something wrong here ?

Thank's in advance !

Steps to Reproduce

My minimum iOS version is 16.0 :

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">16.0</SupportedOSPlatformVersion>
CPGridButton gridButton;

if (OperatingSystem.IsIOSVersionAtLeast(26, 0))
{
    gridButton = new CPGridButton([text], image, messageConfiguration: null, handler: null); // Warning here
}
else
{
    gridButton = new CPGridButton([text], image, handler: null);
}

rows.Add(gridButton);

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions