0

使用PubNub并尝试设置推送ios(apns)per their docsPubNub AngularJS推送配置错误:'Pubnub.push.addChannels'未定义

下生成错误:

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并推动工作时,应用程序在后台应该工作。令牌是有效的,真实iPhone设备上运行,而从

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); 
    } 

完整的错误返回在Safari控制台:

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

找不到在谷歌的这个错误什么。

回答