小编use*_*365的帖子

APNS自定义声音

我想发送带有自定义声音的推送通知,但总是我尝试,我只听到默认的事情.

我的声音被命名为wil.caf,我在我的xcode项目中有它.

这是我的php sript发出推送消息:

<?php

$message = $_GET["message"];

$deviceToken = $_GET["token"];


$devideToken = dechex ($deviceToken);
// Payload erstellen und JSON codieren

$payload['aps'] = array('alert' => $message, 'badge' => 0, 'sound' => 'default');
$payload = json_encode($payload);
$apnsHost = 'gateway.push.apple.com';

$apnsPort = 2195;

$apnsCert = 'apsDevBundle2.pem';



// Stream erstellen

$streamContext = stream_context_create();

stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);



$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);

if ($apns)

{

  // Nachricht erstellen und senden

  $apnsMessage = chr(0) . …
Run Code Online (Sandbox Code Playgroud)

php audio xcode apple-push-notifications

3
推荐指数
1
解决办法
6491
查看次数

标签 统计

apple-push-notifications ×1

audio ×1

php ×1

xcode ×1