NotificationService.m 方法未调用。 在前台,“willPresentNotification:(UNNotification *)notification withCompletionHandler:”这个方法也不会被调用。
未看到通知。
但是这个方法“application:didReceiveRemoteNotification:fetchCompletionHandler:”是为推送到设备的静默通知而调用的。但是设备没有收到通常的推送通知。
设备令牌是正确的,因为静默通知正在到达,但普通的推送通知本身并没有到达客户设备上。请帮忙。这仅适用于装有 OS 14.3 的客户设备。相同的通知正在到达其他设备。所以有效载荷格式没有问题。请帮忙。
答案 0 :(得分:1)
也许在某些特定情况下,通知委托没有准备好处理它们。
确保在 UNUserNotificationCenter
处设置 application willFinishLaunchingWithOptions
的委托。这是 Apple 建议在其 documentation 上执行的操作:
- (BOOL) application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
}