I have created an override for the virtual RegisterForRemoteNotifications in the AppDelegate, which looks like this:
public async override void RegisteredForRemoteNotifications(NSApplication application, NSData deviceToken)
{
Debug.WriteLine("This method has been reached");
base.RegisteredForRemoteNotifications(application, deviceToken);
var credentials = NotificationRegistrar.Credentials;
var client = new AmazonSimpleNotificationServiceClient(credentials, RegionEndpoint.APSoutheast2);
var request = new CreatePlatformEndpointRequest();
request.PlatformApplicationArn = "{ARN}";
request.Token = deviceToken.Description;
await client.CreatePlatformEndpointAsync(request);
}
However, my method is not being reached at all, wherever it might be (supposed) triggered from. At first, I thought this might be due to the fact I was calling the RegisterForRemoteNotifications method from outside the AppDelegate, after the app had been initialised. But when moving the call to inside DidFinishLaunching, whether before Forms.Init or after, or whatever I tried, my override is not being reached.
Now interestingly, neither is the FailedToRegisterForRemoteNotifications override being called. However, if I uncheck "Sign the application bundle" under the Mac Signing section for the project, FailedToRegisterForRemoteNotifications is called, likely due to the fact that a provisioning profile is required for APNs registration. But why do neither get called with signing with the identity and provisioning enabled? All the permissions / capabilities required are there (I assume). com.apple.developer.aps-environment has been set to development in Entitlements.
Also interesting is the fact that IsRegisteredForRemoteNotifications does change whenever I call either Register/UnregisterForRemoteNotifications, but the overrides are not called.
It seems that Big Sur itself is the issue for the development environment, as it is working on a production environment. The solution is to either revert back to Catalina or lower, or attempt to test notifications with a production release.