push-notification - 为什么我的 iOS 13 应用程序在被用户终止时通过静默推送在后台唤醒

标签 push-notification push ios13 silentpush

我不知道这是苹果的错误还是功能。在 the documentation :

system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.



正如其他 StackOverflow 问题一样 this this显示相同。

在我的情况下,系统在后台重新启动应用程序并运行用于存储在数据库中的代码。怎么可能呢?它调用方法 didFinishLaunchingWithOptions: 然后 didReceiveRemoteNotification:在后台(未显示在应用切换器中)。但是在早期版本中,它不会唤醒在 iOS 12.2 中测试的后台应用程序

我正在发送有效载荷以进行通知
  "aps": {
    "alert": {
      "body": "",
      "title": ""
    },
    "mutable-content": 0,
    "category": "",
    "badge": "",
    "sound": "",
    "content-available": 1
  },
  "data": {
   //other fields
  }
 }


最佳答案

我正在使用 13.3,我无法复制它。当用户强制退出但根本无法工作时,努力唤醒应用程序。
我什至在这个 FCM 负载中使用了 2 content_available 和 content-available:

{
    "registration_ids": [
        "dX0-3Mmu9UIirh_ov4wJpl:APA9111112222233333jVRvrsvtoarX4zjtq1UjjaNtxPRL9UmXdV1l5DYMxJ86DTVxG9TDkqIEldEoRthisEfZQ5lOe8wY5ef2xoBtYv5rAM4CJizDblNh5qoZV2VvQxtoRRTIv1GiB"
    ],
    "priority": "high",
    "content_available": true,
    "content-available": 1,
    "data": {
        // other data
    }
}

关于push-notification - 为什么我的 iOS 13 应用程序在被用户终止时通过静默推送在后台唤醒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58128321/

相关文章:

ios - 在 Openshift 上使用 Node.js 发送 iOS 推送通知

ios - 如何在 iOS 13 上设置 UIToolbar 高度

iphone - Apple 推送通知、注销应用程序和删除应用程序问题/解决方案

php - 没有 node.JS 的推送系统

android - 我现在应该使用什么方法,因为 FirebaseInstanceId.getInstance().getToken() 已被弃用

react-native - Share 在 iOS 13 上不起作用。 Expo 模块

ios - WebSql iOS13 支持已删除,迁移前的替代解决方案

ios - 像 Pebble 一样捕获所有 iOS 推送通知

当 native 闹钟响起时发送推送通知的 iOS 应用程序

c - 推送到仅包含 C 中唯一值的堆栈