【发布时间】:2019-01-17 23:50:00
【问题描述】:
在我的 app.component.ts 文件中,我有一个代码,如果用户点击 FCM 通知,该代码会将用户发送到不同的页面 代码是这样的:
this.fcm.listenToNotifications().subscribe(async(notification) => {
if (notification.tap) {
const pages = [
{page: Page1},
{page: Page1Subpage, params: {...}}
];
this.navCtrl.setPages(pages);
this.navCtrl.parent.select(1);
}
当我执行通知时,我在 Xcode 编辑器中看到以下错误:
2019-01-17 16:55:13.230990+0200 Adservio[2103:800067] ERROR: Unhandled Promise rejection: null is not an object (evaluating 'this.navCtrl.setPages') ; Zone: <root> ; Task: Promise.then ; Value: TypeError: null is not an object (evaluating 'this.navCtrl.setPages') http://localhost:8080/var/containers/Bundle/Application/9301607C-7904-4404-B00D-FE8D9E7EED17/Adservio.app/www/build/main.js:1:1380986
有人知道为什么吗?
【问题讨论】:
-
删除
async,订阅已经为您处理了。
标签: angular ionic-framework ionic3