Question:
Hi, I created a class implementing the PushNotificationDelegate protocol and also a property of this class in appDelegate.
The method onDidRegisterForRemoteNotificationsWithDeviceToken in this class is called but onPushReceived and onPushAccepted are never called on iOS 10+ devices.
Answer:
If it is iOS 10 or above, it looks like you have missed a call of [UNUserNotificationCenter currentNotificationCenter].delegate = [PushNotificationManager pushManager].notificationCenterDelegate;
Please note that pushes are handled in a Notification Center delegate, so if your device is running iOS 10+ and you do not register a delegate for Notification Center, it will result in the same behavior you currently experience. Please double-check you have added the following lines to your AppDelegate:
if (@available(iOS 10.0, *)) {
[UNUserNotificationCenter currentNotificationCenter].delegate = [PushNotificationManager pushManager].notificationCenterDelegate;
}
It still works fine on iOS 9 and lower versions since it does not use UserNotifications framework. This code does not get executed, push received and push opened events are still firing correctly.
Comments
0 comments
Please sign in to leave a comment.