IOS 发送自定义的静默推送通知 Key/Value
IOS Silent Push Notification to send custom Key/Value
我有一个需要发送自定义 key/value 对的用例。请看下面的例子:
{
"aps":{"content-available":1},
"test_data":{"Name":"Vinay"}
}
我最后完成了这个练习,但我无法发送它,而且我还没有找到 Apple 限制它的明确证据。任何人都可以在这种情况下支持我。
是的,Apple 授权它静默推送。事实上,Apple 解释了如何做到这一点:
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.
并且,在配置静默通知中:
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.
更新:
但似乎不可能有一个完全无声的推送和自定义数据。它没有很好的记录,但看看这个:
除非您配置良好,否则这不会有任何问题。有关配置详细信息,请参阅苹果文档。我已经创建了一个 POC,它工作得很好,如果我们使用 Artisian SDK(旧版本),我只注意到一次问题,所以它会吞噬你的有效负载,这是我面临的唯一问题。
准确地说:
我们可以在后台调用应用程序而不用使用静默通知来通知用户。我们可以发送自定义数据,如下例所示:
{"Data":"Vinay","aps": {"content-available": 1}}
我有一个需要发送自定义 key/value 对的用例。请看下面的例子:
{
"aps":{"content-available":1},
"test_data":{"Name":"Vinay"}
}
我最后完成了这个练习,但我无法发送它,而且我还没有找到 Apple 限制它的明确证据。任何人都可以在这种情况下支持我。
是的,Apple 授权它静默推送。事实上,Apple 解释了如何做到这一点:
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.
并且,在配置静默通知中:
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.
更新:
但似乎不可能有一个完全无声的推送和自定义数据。它没有很好的记录,但看看这个:
除非您配置良好,否则这不会有任何问题。有关配置详细信息,请参阅苹果文档。我已经创建了一个 POC,它工作得很好,如果我们使用 Artisian SDK(旧版本),我只注意到一次问题,所以它会吞噬你的有效负载,这是我面临的唯一问题。
准确地说: 我们可以在后台调用应用程序而不用使用静默通知来通知用户。我们可以发送自定义数据,如下例所示:
{"Data":"Vinay","aps": {"content-available": 1}}