APNS JSON PAYLOAD - more arguments

前端 未结 3 791
长发绾君心
长发绾君心 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 22:15

    I use the following in PHP

    $title = 'My Test Message';
    $sound = 'doorbell.caf';
    $msgpayload=json_encode(array('aps' => array('alert' => $title,'sound' => $sound,)));
    
    
    $response = $sns->publish(array(
        'TopicArn' => $TopicArn,
        'MessageStructure' => 'json',
        'Message' => json_encode(array(
            'default' => $title,
            'APNS_SANDBOX' => $msgpayload
        ))
    ));
    

提交回复
热议问题