【发布时间】: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