当应用程序在后台运行时,推送通知工作正常,当应用程序处于前台时,主要问题会出现。我能够接收有效负载,但通知横幅中未显示通知
下面收到的有效载荷
{"data": {"fcm_options": {"image": "https://importduniya.com/dealer/particular/TrustyCane.jpg"}}, "messageId": "1591459535622805", "mutableContent": true, "notification": {"body": "Test123", "ios": {}, "title": "Test"}, "sentTime": "1591459535"}
我认为当应用程序处于前台时不会调用以下函数
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
NSLog(@"will-present");
completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}
你应该实现application:didReceiveRemoteNotification:fetchCompletionHandler:以及