我试图使用Windows作为后端的Safari推送通知。我能够将Website Push ID: web.com...证书上传到Azure Mobile Services,并且在apple push notification settings中没有任何错误消息就被接受了。
为了处理working (webServiceURL/version/pushPackages/websitePushID、webServiceURL/version/devices/deviceToken/registrations/websitePushID等),我在Mobile中创建了一个运行良好的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由于某种原因不支持?
据我所知,iOS、Mac和Safari通知的APNS都是相同的。
更新:,我用SimplePush测试了它,所以证书很好,就像注册SimplePush一样。我的有效载荷是这样的:
// Create the payload body
$body['aps'] = array(
'alert' => array(
'title' => 'test',
'body' => $message
),
'url-args' => array('test'),
);发布于 2013-11-19 03:03:04
我假设您已经按照Apple的指导正确注册了Safari客户端--您在非Azure实现上测试了您的客户端吗?从苹果的实现指南看,似乎有很多移动的部分,即使没有考虑到Azure作为您的推送信息来源。
https://stackoverflow.com/questions/19941948
复制相似问题