APNS JSON PAYLOAD - more arguments

前端 未结 3 898
长发绾君心
长发绾君心 2020-12-17 21:23

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

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 21:58

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

    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"
    }
    

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

提交回复
热议问题