简体   繁体   English

在iOS 7推送通知中正确使用“内容可用”

[英]Proper use of “content-available” in iOS 7 Push Notifications

I'm just looking for some feedback on my thought process surrounding iOS 7 and the "content-available" key value in a push notification payload. 我只是在寻找有关iOS 7思维过程和推送通知负载中“内容可用”键值的反馈。

Scenario: I force shut down the application. 场景:我强制关闭应用程序。 According to Apple because I've done this I will no longer receive any notifications that contain the key value "content-available" in their payload. 根据Apple的说法,因为我已经这样做了,我将不再收到任何包含其有效负载中键值“content-available”的通知。 This means that the alert doesn't show at all, basically nothing happens. 这意味着警报根本没有显示,基本上没有任何反应。 No sounds, no alert message, no badge increment. 没有声音,没有警报信息,没有徽章增量。

Theory: Because of the above scenario it seems as if you'd want to send two push notifications. 理论:由于上述情况,您似乎想要发送两个推送通知。

  1. A push notification with just your "alert","badge" and "sound" values so that the user sees a notification related to the update irregardless of the application state. 只有您的“警报”,“徽章”和“声音”值的推送通知,以便用户看到与更新相关的通知,而不管应用程序状态如何。

  2. A push notification with just the "content-available" key value. 仅包含“内容可用”键值的推送通知。 If the app is in a state where it can accept this it does and your background task is performed. 如果应用程序处于可以接受此状态的状态,则会执行后台任务。 In the case it can't accept it the user still receives a visual / audible notification from the first push notification. 在它不能接受的情况下,用户仍然从第一推送通知接收视觉/听觉通知。

Question: Is this how Apple intends the silent / background notifications to be executed? 问题:这是Apple打算如何执行静音/背景通知吗? I don't really see another way that you could implement this. 我真的没有看到你可以实现的另一种方式。

I think your thought process is right and the information you have is correct for the current implementation of push notifications in iOS 7.0 我认为您的思维过程是正确的,您拥有的信息对于iOS 7.0中推送通知的当前实现是正确

However people have been filing bug reports and talking about the fact that forcibly quitting the app makes it ineligible to be woken up by a push notification with "content-available" in the payload (See SO answer ). 然而,人们一直在提交错误报告并且谈论强行退出应用程序这一事实使得它没有资格被有效负载中“内容可用”的推送通知唤醒(参见SO回答 )。 Hopefully Apple will address this in iOS 7.1 or at least update the docs. 希望Apple能够在iOS 7.1中解决这个问题,或至少更新文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用带有“内容可用”的Azure CustomTemplate Push通知在后台更新iOS应用吗? - Can I use Azure CustomTemplate Push notifications with “content-available” to update iOS app in the background? 注册仅适用于内容的推送通知 - Register for content-available push notifications only iOS 7.1是否打破了针对非报亭应用的内容可用(又称无声)推送通知? - Did iOS 7.1 break content-available (aka silent) push notifications for non-newsstand apps? 当“内容可用”时,iOS远程通知不起作用:1 - iOS Remote Notifications not working when “content-available”: 1 禁用了推送通知的用户是否可以使用具有内容可用的推送通知? - Do Push Notifications with content-available work for users that have disabled Push Notifications? 推送通知 Json 中“内容可用”的目的是什么? - The purpose of “Content-available” in Push Notification Json? 使用解析服务器云代码发送推送通知,使用可用的内容不起作用 - Sending Push Notifications with Parse Server Cloud Code using content-available not working 解析并快速处理:didReceiveRemoteNotification未接收到带有“ aps”:{“ content-available”:1}的推送通知 - Parse and Swift: Push notifications with “aps”: {“content-available”: 1} not being received by didReceiveRemoteNotification Azure服务器脚本:将通知推送到iOS设备:如何将可用内容设置为1? - Azure Server Script: Push Notification to iOS device: How to set content-available to 1? Pushkit和可用内容 - Pushkit and content-available
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM