Windows Azure をバックエンドとしてSafari プッシュ通知を使用しようとしています。Website Push ID: web.com...
Azure に証明書をアップロードすることができMobile Services
、apple push notification settings
.
Web サービス エンドポイント ( webServiceURL/version/pushPackages/websitePushID
、webServiceURL/version/devices/deviceToken/registrations/websitePushID
など) を処理するために、すべて正常に動作する API をモバイル サービスで作成しました。
しかし、プッシュ通知を送信したり、エラー メッセージを取得したりできません。
私のテストコードは次のようになります。
function send(req, res) {
var push = req.service.push;
var devicesTable = req.service.tables.getTable('devices');
devicesTable.read({
success: function(devices) {
devices.forEach(function(device) {
console.log("send to deviceToken " + device.deviceToken);
push.apns.send(device.deviceToken, {
alert: 'Toast: A new Mobile Services task.',
payload: {
inAppMessage: "Hey, a new item arrived: '"
}
});
push.apns.send(device.deviceToken, {
alert: {
"title": "Test 123 ",
"body": "Test 123 ",
"action": "View"
},
"url-args": ["boarding"]
},
{
error : function(err) {
console.log("send error " + err);
}
}
);
});
}
});
res.send(200, "");
}
私の問題はディクショナリの書式設定ですか、それとも Azure Mobile Services は何らかの理由で Safari プッシュ通知をサポートしていませんか?
私の知る限り、APNS は iOS、Mac、Safari のプッシュ通知で同じです。
更新: SimplePushでテストしたので、証明書は Safari の登録と同様に問題ありません。私のペイロードは次のようになります。
// Create the payload body
$body['aps'] = array(
'alert' => array(
'title' => 'test',
'body' => $message
),
'url-args' => array('test'),
);