gpt4 book ai didi

ios - 什么是静默推送通知?设备什么时候收到它?

转载 作者:IT王子 更新时间:2023-10-29 07:36:52 29 4
gpt4 key购买 nike

我想清除通知栏中的本地通知。为此实现后,我正在考虑使用静默推送通知。所以我想要确认设备何时收到它以及我可以用它做什么?

最佳答案

它们可用于在不通知用户的情况下通知应用程序新内容。该应用程序不会显示通知警报,而是在后台唤醒(如果用户强制退出,iOS 不会自动启动您的应用程序)和 application:didReceiveRemoteNotification:fetchCompletionHandler:将被调用。然后您就有机会为用户透明地处理任何信息:

  • 下载一些内容
  • 同步一些元素,
  • 当用户重新打开应用程序时,直接在应用程序内通知用户

请注意,您的时间限制为 30 秒。

配置静默通知

To support silent remote notifications, add the remote-notification value to the UIBackgroundModes array in your Info.plist file. To learn more about this array, see UIBackgroundModes.

<key>UIBackgroundModes</key>
<array>
    <string>remote-notification</string>
</array>

Configuring a Silent Notification

The aps dictionary can also contain the content-available property. The content- available property with a value of 1 lets the remote notification act as a silent notification. When a silent notification arrives, iOS wakes up your app in the background so that you can get new data from your server or do background information processing. Users aren’t told about the new or changed information that results from a silent notification, but they can find out about it the next time they open your app.

For a silent notification, take care to ensure there is no alert, sound, or badge payload in the aps dictionary. If you don’t follow this guidance, the incorrectly-configured notification might be throttled and not delivered to the app in the background, and instead of being silent is displayed to the user

关于ios - 什么是静默推送通知?设备什么时候收到它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36694963/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com