【发布时间】:2020-03-24 01:24:41
【问题描述】:
我的 Ionic 5 应用想要发送推送通知。我能找到的唯一指南是Using Push Notifications with Firebase in an Ionic + Angular App
为什么需要 Firebase?我可以在没有 Firebase 的情况下发送推送通知吗?
我还是尝试了这个设置。我没有走很远。
指南有这个代码:
// Request permission to use push notifications
// iOS will prompt user and return if they granted permission or not
// Android will just grant without prompting
PushNotifications.requestPermission().then( result => {
if (result.granted) {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
} else {
// Show some error
}
});
但是,Typescript 抱怨正确的方法是 requestPermissions() 而不是 requestPermission()。
在 XCode 中运行时两者都失败,可能是因为我没有设置 pod。
Ionic 5 + Capacitor 有哪些选项可以在不使用 Firebase 的情况下发送推送通知?
【问题讨论】:
标签: ionic-framework push-notification apple-push-notifications capacitor