首页 文章

使用Windows Azure推送Safari推送通知

提问于
浏览
3

我正在尝试将Safari Push Notifications与Windows Azure一起用作后端 . 我能够将 Website Push ID: web.com... 证书上传到Azure Mobile Services 并且在 apple push notification settings 中没有任何错误消息被接受 .

为了处理Web服务 endpoints ( webServiceURL/version/pushPackages/websitePushIDwebServiceURL/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 Mobile Services不支持Safari推送通知?

据我所知,APNS与iOS,Mac和Safari推送通知相同 .

Update: 我用SimplePush测试了它,所以证书很好,就像注册Safari一样 . 我的有效负载如下所示:

// Create the payload body
$body['aps'] = array(
    'alert' => array(
        'title' => 'test',
        'body' => $message
    ),
    'url-args'  => array('test'),
);

1 回答

  • 0

    我假设您已根据Apple的指导正确注册了Safari客户端 - 您是否在非Azure实施中测试了客户端?看看Apple的实施指南,即使不将Azure视为推送信息源,也似乎有很多移动部件 .

相关问题