Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
369 views
in Technique[技术] by (71.8m points)

objective c - iOS app not receiving notifications but ONLY silent notification is received

NotificationService.m method not invoked. When in foreground, "willPresentNotification:(UNNotification *)notification withCompletionHandler:" this method is not called either.

No notifications are seen.

But this method "application:didReceiveRemoteNotification:fetchCompletionHandler:" is called for a silent notification pushed to the device. But the device is not receiving the usual push notifications.

Device token is all correct as silent notification is reaching, but normal push notifications alone are not reaching the on the customer device. Kindly help. This is only on a customer device with OS 14.3. The same notifications are reaching other devices. So no issues with the payload format. Kindly help.

question from:https://stackoverflow.com/questions/65914924/ios-app-not-receiving-notifications-but-only-silent-notification-is-received

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...