Skip to content

[iOS] Lifecycle for push notifications needs to be conditionally implemented #24237

@Redth

Description

@Redth

Description

For .NET 9 Preview 7, we added iOSLifecycle.OnReceivedRemoteNotifications and iOSLifecycle.OnRegisteredForRemoteNotifications lifecycle events in #23452 (Yay!)

But we forgot to ensure that for cases when an app does not want these implemented, it needs to appear to Apple that it is not using them, otherwise I believe apps will be flagged in submission for not including the appropriate entitlements (need to fact check this).

I believe we could do this by overriding RespondsToSelector on the delegate and checking for these selectors and returning false if we have determined the app isn't actually wiring up the registration (need to fact check this).

We need to decide how we want to determine that. Maybe we can look at the entitlements at runtime and see if aps entitlement is declared? or we can set a flag when registering for the lifecycle event, however this may conflict with cases where someone manually overrides these methods on their delegate. We could also have a property on the delegate to toggle this on and off.

Version with bug

9.0.0-preview.7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.0-preview.6

Affected platforms

iOS, macOS

Did you find any workaround?

For now, one could manually override RespondsToSelector and return false when these are queried if they do not want to appear to have them implemented.

Thanks @aritchie for noticing this change and helping flag the potential issues with it!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions