无法使用Node.js和Node-GCM在ios中接收通知

时间:2018-12-11 14:32:53

标签: ios node.js node-gcm

我正在尝试使用node-gcm将通知推送到我的ios应用程序,但是它不起作用,相同的代码在android上也能很好地工作

  var gcm = require('node-gcm');
  var sender = new gcm.Sender('');
  var message = new gcm.Message({
           collapseKey: 'demo',
           priority: 10,
           contentAvailable: true,
           delayWhileIdle: true,
           timeToLive: 3,
           restrictedPackageName: "",
           data: { 
              title: 'Test 5',
              body: 'Test 5 for notification, marwan if you see this let me know the number of test on slack',
            },
            notification: {
              title: "test",
              body: "This is a notification that will be displayed if your app is in the background."
           }
        });


        var regTokens = [];
        sender.send(message, { registrationTokens: regTokens }, function (err, response) {
           if (err) console.error('error : ',err);
           else console.log('response',response);
        });

当我发送通知时,响应消息是:

  

响应{multicast_id:8212613428371279000,     成功:2     失败:0,     canonical_ids:0,     结果:      [{message_id:'0:1544538236085625%a4d7d7f4a4d7d7f4'},        {message_id:'0:1544538236085274%a4d7d7f4a4d7d7f4'}]}

但是我的iPhone / iOS应用上什么也没显示,有什么帮助吗?

0 个答案:

没有答案