离子2.0 科尔多瓦版本6.3.1 的Xcode 8如何使用离子获取IOS设备令牌?
已经尝试过这两个环节,但是它并没有帮助。
http://ngcordova.com/docs/plugins/pushNotifications/
https://github.com/hollyschinsky/PushNotificationSample
寻找用于取入使用离子IOS的设备令牌一个详细的教程/材料。
离子2.0 科尔多瓦版本6.3.1 的Xcode 8如何使用离子获取IOS设备令牌?
已经尝试过这两个环节,但是它并没有帮助。
http://ngcordova.com/docs/plugins/pushNotifications/
https://github.com/hollyschinsky/PushNotificationSample
寻找用于取入使用离子IOS的设备令牌一个详细的教程/材料。
要使用离子推送通知工作,你必须有近期发布即离子版本2离子的版本,如果你有旧版本(低于离子1版)将无法正常工作。
的CordovaPush,CordovaPush V5都已经过时,所以不要使用它们。
在离子2的推送通知详细的了解请参阅此ionic 2 push
你有设备准备好事件后使用该plugin
if (device.platform == 'iOS'){
pushNotification.register(
tokenHandler,
errorHandler,
{
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotificationAPN"
});
}
}
写这篇文章。
function errorHandler(error) {
alert(error);
}
这是错误回调函数。
function tokenHandler(result){
// Your iOS push server needs to know the token before it can push to this device
// here is where you might want to send it the token for later use.
//alert('device token = ' + result);
sDeviceId = result ;
}
在sDeviceId中,您可以获取设备令牌。
http://ngcordova.com/docs/plugins/pushNotifications/
试试这个只有
我也面临着同样的问题。
请检查IOS操作系统版本的测试设备。如果是10.0以上版本请不要在Xcode中设置
适当改变capabilties部分
允许推送通知(应检查)。
PFB:
ios版本不是10或以上它只有8 ...如果我使用相同的代码控制将不会进入这里“document.addEventListener(”deviceready“,function(){”t(http://ngcordova.com/docs/plugins/pushNotifications/),所以我不是能够获得设备令牌.....所以你可以请建议可以做些什么.. – Aniruddh
没有必要调用设备内准备好的注册功能 –
设备准备好功能没有必要注册设备 –
看到这个http://stackoverflow.com/questions/36717556/retrieve-the-device-token-from-device-using-ionic-框架 –
您可以使用全局变量“device”来访问设备ID等属性。 device.uuid –