Maybe there are some specific conditions in which the notifications delegate was not prepared to handled them.
Make sure to set the delegate for UNUserNotificationCenter
at application willFinishLaunchingWithOptions
. This is what Apple recommends to do on their documentation:
- (BOOL) application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…