Not receiving push device token in macOS development builds

Hi there,

I'm seeing weird behavior when trying to register for push notifications in macOS development builds for any of my apps

I'm calling registerForRemoteNotifications() on my NSApplication object but I never receive any callbacks in my AppDelegate. Neither didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError is ever called.

The code works perfectly in release builds where I receive the device token as expected in the delegate method.

I'm getting the exact same behavior on two Macs (both running the latest Catalina version). My code signing settings are set to "Automatically manage signing" and my apps use Xcode managed Provisioning Profiles which include the "Push Notifications" capability and the "com.apple.developer.aps-environment" entitlement.

Is this in any way a known problem?
I'm seeing the same behavior on Big Sur but the Catalina build is working for me.
There was indeed 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.
  1. Turn off WiFi and/or disconnect the network cable

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

  3. 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 am having the same issue. iOS devices work fine, but macOS devices won't connect to the development push service. Bug report: FB8968738
One of my two Mac devices has this issue, but them are the same OS version, under the same network.


On the problem Mac, none of "didRegisterForRemoteNotificationsWithDeviceToken" and "didFailToRegisterForRemoteNotificationsWithError" has been called. So wired.


Changing network worked in my case, I used cellular data on my iPhone and now it works

Not receiving push device token in macOS development builds
 
 
Q