我正在尝试使用 Safari Push Notifications以 Windows Azure 作为后端。我能够将网站推送 ID:web.com...
证书上传到 Azure 移动服务
,并且该证书已被接受,Apple 推送通知中没有任何错误消息设置
。
为了处理我创建的 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, "");
}
我的问题是 formatting of the dictionary或者 Azure 移动服务是否由于某种原因不支持 Safari 推送通知?
据我所知,iOS、Mac 和 Safari 推送通知的 APNS 是相同的。
更新:我使用 SimplePush 对其进行了测试所以证书和 Safari 的注册都可以。我的有效负载如下所示:
// Create the payload body
$body['aps'] = array(
'alert' => array(
'title' => 'test',
'body' => $message
),
'url-args' => array('test'),
);
最佳答案
我假设您已按照 Apple 的指导正确注册了您的 Safari 客户端 - 您是否在非 Azure 实现上测试过您的客户端?查看 Apple 的实现指南,即使不考虑将 Azure 作为推送信息源,似乎也有很多变化。
关于azure - Safari 推送通知与 Windows Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19941948/