APNS JSON PAYLOAD - 更多参数 [英] APNS JSON PAYLOAD - more arguments

查看:15
本文介绍了APNS JSON PAYLOAD - 更多参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 APNS 服务的 json 负载添加一些参数.我怎样才能做到这一点?这是苹果的文档:http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1

I need to add some arguments to a json payload for APNS service. How can i do this? this is the documentation of apple: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1

当我尝试发送带有关闭和查看按钮的消息时,我需要添加我的移动应用程序需要的另外两个参数.有什么想法吗?

When i try to send a message with close and view buttons, i need to add two more arguments that my mobile application needs. Any idea?

推荐答案

不确定你是否得到了答案.但这是文档中提到的

Not sure if you got the answer yet. But this is what the documentation mentions

提供者可以指定自定义负载Apple 保留的 aps 之外的值命名空间.自定义值必须使用JSON 结构化和原始类型:字典(对象)、数组、字符串、数字和布尔值.

Providers can specify custom payload values outside the Apple-reserved aps namespace. Custom values must use the JSON structured and primitive types: dictionary (object), array, string, number, and Boolean.

因此,为了向您的负载添加自定义值,只需将它们作为键值对添加到您的负载中.像这样

So in order to add custom values to your payload, just add them as key-value pairs in your payload. Something like this

{
    "aps":{
        "alert":"Your Message",
        "sound":"push1.wav"
     },
     "custom_key1":"value1",
     "custom_key2":"value2"
}

这里 custom_key1custom_key2 是您的自定义键,value1value2 是它们的值.

Here custom_key1 and custom_key2 are your custom keys and value1 and value2 are their values.

这篇关于APNS JSON PAYLOAD - 更多参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆