ios – 什么是静音推送通知?设备什么时候收到?

前端之家收集整理的这篇文章主要介绍了ios – 什么是静音推送通知?设备什么时候收到?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在通知栏中清除本地通知.为了这样
实现了,我正在考虑使用静音推送通知.所以我想要
确认设备何时收到它,以及我可以做什么?

解决方法

它们可以用于通知内容的应用,而无需用户通知.而不是显示通知警报,应用程序将在后台和应用程序中被唤醒: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相关文章