RegisterForRemoteNotifications throws com.apple.UNSNotificationRegistrarConnection

The app called the following methods to register push notification when the app launched


[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications];


However there is a small chance that the app will throw the following exception when it executes registerForRemoteNotifications

Crashed: com.apple.UNSNotificationRegistrarConnection EXC_BAD_ACCESS KERN_INVALID_ADDRESS


It is difficult to reproduce and not always happens. Does anyone know what is the root cause of this issue? Many thanks.

RegisterForRemoteNotifications throws com.apple.UNSNotificationRegistrarConnection
 
 
Q