iOS-13 Unable to receive Device Token.

Hello There,
After upgrade to iOS-13, we are unable to receive Device Token (intermittent) when we perform

UIApplication.shared.registerForRemoteNotifications()

neither delegates calling back.

application:didRegisterForRemoteNotificationsWithDeviceToke
application:didFailToRegisterForRemoteNotificationsWithError

We are performing all the operation on Wifi network So here strange thing is all is working fine with iOS-10, 11, 12 however not in iOS-13 so we are kind of blocked here, Also assuming there must be some improvement/ modification that is causing the issue.


We have tried Restart/Reboot device, Disable/Enable and Change network connection and found its working (intermittent not 100%) however this is not the actual solution of the problem. User perspective we can not force the user to Restart/ Reboot the device.

Replies

We're having the same issue and it is quite frustrating.

You did not mention permissions. I hope everything's fine but this is first that come to mind with your description:

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
  if let error = error {
  print("D'oh: \(error.localizedDescription)")
  } else {
  application.registerForRemoteNotifications()
  }
}
Hello Sahuja, did you solve the problem?
This is happening to me. Neither delegates was called.
Has anyone at Apple acknowledged this intermittent iOS device registration issue when using WiFi? I have been having this problem for weeks using Azure Push Notifications. Microsoft brushed it off telling us "It is an Apple issue".
This was a temporary issue that happened when testing apps in the development/sandbox environment, and caused by the device not being able to establish a connection to APNs. This has been corrected for some time now.

If you are still encountering this problem temporarily, this is likely a connection hiccup on the device side. In this context, a connection issue means that the device is not able to reach the APNs servers/ports, and/or not reachable by the APNs servers.

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. Put the device in Airplane Mode.

  2. After a few seconds, take it out of Airplane Mode. This will cause the device to try to reestablish its persistent connection to APNs.

  3. Run your app again to request a new token

If this is not resolving the issue, you can try the same after switching to another network, if possible. Alternatively you can try switching to/from a cellular connection to see if that makes a difference.

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

If you use Wi-Fi 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.

Well, I do not see installing an iOS app using Cellular Data instead of Wifi that makes use of Push Notifications as a solution.

At least Microsoft has acknowledged this iOS defect in their Xamarin Push Notification sample code...

https://github.com/xamarin/xamarin-forms-samples/commit/b4c1b55f9ecbdeced089c5fe1ad880e6c453eac6

_"On iOS 13 and greater, you may experience intermittent device registration issues if your app is running over a wireless network, rather than a cellular network. For more information, and a workaround, see iOS-13 Unable to receive Device Token on developer.apple.com."_

We have lost endless hours dealing with this issue. I wonder why Xamarin Android does not have this issue using the same Wifi and/or Cellular tower connection. Anyone know?