【问题标题】:Show content_available notifications in iOS在 iOS 中显示 content_available 通知
【发布时间】:2018-02-02 15:41:04
【问题描述】:

我们的服务器正在向content_available: true 发送通知,用于在 android 和 iOS 上发送通知,这曾经在我们以前的 Ionic 混合应用程序上工作,但是当我们开始使用带有 swift 的原生 iOS 时,通知会进来,但不会显示任何警报背景,有没有办法在后台显示警报而不关闭content_available,因为android应用需要它

【问题讨论】:

  • 您的后台模式是否启用通知?
  • 我必须为通知启用后台模式吗?我该怎么做

标签: ios swift firebase apple-push-notifications firebase-cloud-messaging


【解决方案1】:

如果您希望您的 iOS 设备接受静默通知,通过添加值为 1(不是 true)的 content-available(不是 content_available)键,然后在 Xcode 中打开项目导航器(command- 1),选择你的项目,然后选择你的应用目标。在 Capabilities 表上,将 Background Modes 选项切换为 on,然后检查列表末尾的 Remote notifications。

请记住,静默通知来自 application(_:didReceiveRemoteNotification:fetchCompletionHandler)

【讨论】:

    猜你喜欢
    • 2018-01-17
    • 1970-01-01
    • 2017-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多