在iOS上点击“推送通知”时,Ionic 4无法打开目标页面

时间:2019-07-09 06:12:40

标签: ios ionic4 cordova-plugin-fcm

我正在开发一个Ionic应用程序,但是iOS上的FCM推送通知存在问题。我可以在应用程序处于后台或前景时发送通知,但不能在打开应用程序时发送通知。另外,点击通知后,它不会重定向到应用程序的其他页面,而仅显示根页面(在Android中效果很好)。

因此,在iOS中,我需要检索通知数据并正确重定向。

这是一个具有Android和iOS构建代码的Ionic v4应用。我使用这段代码来获取通知数据

this._fcm.onNotificationOpen().subscribe(
            msg => {
                (this.platform.is('ios')) ? ((msg.aps && msg.aps.alert) ? this._toast.presentToast(msg.aps.alert) : this._toast.presentToast(msg.body)) : this._toast.presentToast(msg.body);

                if (msg.title && msg.title === '¡Ayuda!' && msg.origin) {
                    this._fcm.getData('token', msg.origin).subscribe(
                        (res: any) => {
                            this.getContactData(res);
                        }
                    );
                }
            });

在getData函数中,我使用令牌获得了Firebase上的一些数据。此令牌是在通知数据中设置的,因此当我在res中获取数据时,getContactData函数将获取res值并重定向到包含联系人数据的帮助页面。

但是当我调试构建的iOS代码时,我在Xcode控制台中得到了以下错误:

2019-07-09 00:58:33.317597-0400 MuniConceApp[1469:254931] 5.7.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see https://help.apple.com/xcode/mac/8.0/)
2019-07-09 00:58:33.343859-0400 MuniConceApp[1469:254915] 5.7.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.

通知图片:

Image

在此图中,通知显示在iOS上,但是当我点击此通知时,帮助页面不会打开,仅显示根页面(主页)。

0 个答案:

没有答案