【问题标题】:PubNub AngularJS error in push config: 'Pubnub.push.addChannels' is undefined推送配置中的 PubNub AngularJS 错误:“Pubnub.push.addChannels”未定义
【发布时间】:2016-11-06 22:35:49
【问题描述】:

使用 PubNub 并尝试为 ios (apns) per their docs 设置推送。

以下会产生错误:

  var initPubnubPush = function(token) {
    Pubnub.push.addChannels(
      {
          channels: ['my_first_channel'],
          device: token,
          pushGateway: 'apns' // apns, gcm, mpns
      },
      function(status) {
          if (status.error) {
              console.log("operation failed w/ error:", status);
          } else {
              console.log("operation done!")
          }
      }
  );
}

我让他们的发布/订阅在频道my_first_channel 上工作,并且当应用程序在后台时推送应该可以工作。令牌有效,从

返回
pushNotification.register(
      tokenHandler,
      errorHandler,
      {
          'badge':'true',
          'sound':'true',
          'alert':'true',
          'ecb':'onNotificationAPN'
      }
  );

  function tokenHandler(token) {
        // This is a device token you will need later to send a push
        // Store this to PubNub to make your life easier :-)
      initPubnubPush(token);
    }

在真实 iPhone 设备上运行时 Safari 控制台中的完整错误:

Error in Success callbackId: PushPlugin63370093 : TypeError: 
Pubnub.push.addChannels is not a function. 
(In 'Pubnub.push.addChannels', 'Pubnub.push.addChannels' is undefined)

在 google 中找不到任何关于此错误的内容。

【问题讨论】:

    标签: angularjs ionic-framework apple-push-notifications pubnub


    【解决方案1】:

    原来PubNub Angular library 中存在一个错误,并且该方法push.addChannels 未正确委派。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-03
      • 1970-01-01
      • 1970-01-01
      • 2017-08-12
      • 1970-01-01
      • 2018-12-14
      相关资源
      最近更新 更多