I am an iOS development engineer. Recently, I updated the Xcode version to 16.1 (16B40) and updated my debugging device (iPhone 15) to iOS 18.1.1. However, I found that I could not respond to the delegate method.
I confirmed that my code, certificate, Xcode settings, and network environment had not changed. Simply executing
application.registerForRemoteNotifications()
in
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
did not receive a response(didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError ).
In the same environment, when I switched to another device for debugging (iOS 17.0.3), the delegate method would respond.
I really don't know what to do, I hope someone can help me, I would be very grateful.
Please note: Everything is normal when using devices before iOS 18.1.1 version
This issue usually occurs due to:
1- device cannot have a persistent connection to APNs. Either due to security/proxies, etc., or being on an unreliable network. But you say another device in the same environment is OK, so perhaps this isn't it
2- a 3rd party push notifications SDK could be intercepting these callbacks. But if the same app is working on another device, then it is not that either. Unless you are building for each device separately, and there is a configuration mistake in the project based on your target iOS version or something.
Although a stretch, perhaps some system event have caused the device to get into a state that is causing this. try the following:
- Delete the app
- Put the device in Airplane Mode.
- After a few seconds, take it out of Airplane Mode. This will cause the device to try to reestablish its persistent connection to APNs.
- Install the app and try again.
If the problem persists, we may need to look at some diagnostic logs from that device.