離子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 –