简体   繁体   English

离子 5 电容器:使用 ONESIGNAL 的推送通知不适用于 iOS

[英]Ionic 5 Capacitor: Push Notification with ONESIGNAL not working on iOS

I want to use the "onesignal" service to enable push notifications in my Ionic 5 Capacitor App.我想使用“onesignal”服务在我的 Ionic 5 Capacitor App 中启用推送通知。

For Android everything works fine.对于Android,一切正常。 However, in iOS the device is registered with onesignal but it gets the message "Apns Delegate Never Fired" and its registrated as non-active user without push-subscription.但是,在 iOS 中,设备已使用 onesignal 注册,但它收到消息“Apns Delegate Never Fired”,并且在没有推送订阅的情况下注册为非活动用户。

在此处输入图片说明

Many thanks!非常感谢!

I got it working like this:我让它像这样工作:

  • Add the following capabilities in Xcode: Push Notifications, Background Modes -> Background Fetch & Remote notifications在 Xcode 中添加以下功能:推送通知、后台模式 -> 后台获取和远程通知
  • Disable the Capacitor Push Notifications plugin by removing all "USE_PUSH" and "DEBUG USE_PUSH" compilation conditions under the targets build settings (see the plugin documentation here for more details on how to disable the plugin: https://capacitor.ionicframework.com/docs/apis/push-notifications/ )通过删除目标构建设置下的所有“USE_PUSH”和“DEBUG USE_PUSH”编译条件来禁用电容器推送通知插件(有关如何禁用插件的更多详细信息,请参阅此处的插件文档: https : //capacitor.ionicframework.com/文档/apis/推送通知/ )
  • Test with Testflight and not directly with Xcode.使用 Testflight 进行测试,而不是直接使用 Xcode 进行测试。 I don't know why, but it only works while testing with Testflight.我不知道为什么,但它仅在使用 Testflight 进行测试时才有效。 With Xcode, the problem persists.使用 Xcode,问题仍然存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM