我不知道这是苹果的错误还是功能。在 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/