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

Code Block
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?

Accepted Reply

Same here as recent posters. Finally fixed in Big Sur 11.4, works again in both production and developer environments.

Replies

I am seeing the same behavior.
There was a temporary issue a little while back where the devices were unable to connect to APNs for registering in the development environments. This has since been fixed.

If you are experiencing this issue after September 2020, this could be a temporary network glitch, or due to the configuration of your network environment.

If you are getting stuck in the state where this isn’t working, you can try a couple things to kick start the connection again.
  • Turn off WiFi and/or disconnect the network cable

  • After a few seconds, reconnect. This will cause the device to try to reestablish its persistent connection to APNs.

  • Run your app again to request a new token

To resolve more persistent issues, I suggest making sure that your end of the network is properly configured to allow devices access APNs.

If your computer is behind a firewall, or using Private Access Point for cellular data, make sure you can connect to specific ports. 
You need a direct, *unproxied* connection to the APNs servers on these ports:
  • TCP port 5223 to communicate with APNs.

  • TCP port 443 or 2197 to send notifications to APNs.

  • TCP port 443 is required during device activation, and afterwards for fallback (on Wi-Fi only) if devices can't reach APNs on port 5223.

The APNs servers use load balancing, so your devices don't always connect to the same public IP address for notifications. It's best to let your device access these ports on the entire 17.0.0.0/8 address block, which is assigned to Apple.

If you are still unable to register for a token after making sure your network setup is as recommended, please do file a bug report at https://developer.apple.com/bug-reporting/ about not getting any callbacks, so the APNs team can judge the impact this issue is having and help them prioritize a solution.
I'm facing the same problem. I'll file a bug report.
@Gualtier Malde - thank you for the tips. I am still having trouble registering for notifications in both developer and production environments, and am not receiving the callbacks. My network setup is unrestricted and has all the needed permissions. I have filed FB8731513 to that effect.
@Gualtier Malde the problem not resolved in the latest version 20B29.



still have the same issue in Big Sur 11.0.1
I'm also seeing this in my development environment and only on Big Sur (currently version 11.1)

It reports being registered:

NSApp.isRegisteredForRemoteNotifications: true

Connection to APN port seems established:

─$ netstat |grep 5223
tcp4 0 0 macbook-pro-6.la.53515 17.57.146.6.5223 ESTABLISHED


But

didReceiveRemoteNotification
didRegisterForRemoteNotificationsWithDeviceToken
didFailToRegisterForRemoteNotificationsWithError

are never called.


(It's a bit confusing that there are only so few of us reporting this. Wouldn't there be more complaints if it was affecting everyone?)
I have the same issue. :-(
Still a problem
checked with 11.2 - still the same
Also updated to Big Sur 11.2 (Mac mini 2018)
Same problem.

Also tried to change to from Debug to Release. Not working.
Still a problem. Spent way too many hours on this. Please fix Apple.
I'm also suffering from this issue. NSApp.isRegisteredForRemoteNotifications is also true for me. When the entitlements weren't set up, I was getting didFailToRegisterForRemoteNotificationsWithError, but after configuring that, I simply get nothing.
In my case this issue only occur on sandbox mode.
On production mode, I can register and get callbacks properly.
Apple should check APNs' big sur environment especially on sandbox mode.
Confirming I'm facing the same issue, both in development and in release environments. macOS BigSur 11.2.3