Search code examples
apple-push-notificationsmacos-big-sur

registerForRemoteNotifications not working at all in Big Sur?


I am working on a macOS app that involves remote notifications. In my app delegate appDidFinishLaunching, I simply call

NSApplication.shared.registerForRemoteNotifications()

I then get one of two callbacks in the app delegate, either didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError. This has worked fine forever in previous versions.

In Big Sur, this does not seem to work at all. I call the registerForRemoteNotifications, but I never get either callback called.

My hypothesis was that this is because of the new app lifecycle (which is where I originally tried this out). I built a small test app with AppKit app delegate lifecycle. It is equally broken there.

What gives? Why cannot I register for remote notifications in Big Sur?


Solution

  • This was only broken in the development environment. It was always working as expected in production environment, but it was of course difficult to develop and test with this.

    This was fixed in one of the minor versions of Big Sur. I am now using 11.5.1 and it is working now as expected in all environments.