我有同樣的問題...你可以確認你實際上獲得一個令牌的註冊?
如果不是...代碼片斷得到一個線索有關,如果PhoneGap的是載入中... app.componenet.ts 構造(平臺:平臺,狀態欄。:狀態欄,閃屏:閃屏,市民推:推){ platform.ready()。然後,(()=> {// 好了,該平臺已準備就緒,我們的插件可用。 //這裏你可以做任何可能需要更高級別的原生的東西。
// vy added this...
alert('--- ABOUT TO DO PUSH TOKEN CODE -----');
console.log('=== About to look for TOKEN');
this.push.register().then((t: PushToken) => {
// This never happens... never gets to this point in the code.
console.log('=== About to return TOKEN');
return this.push.saveToken(t);
}).then((t: PushToken) => {
console.log('VY***********************************************');
console.log('=== About to SAVE TOKEN');
console.log('Token saved:', t.token);
window.localStorage.setItem("deviceToken", t.token);
console.log('VY***********************************************');
}).catch(function(error){
alert('----error----' + error );
console.log('error-----', error);
console.error(error);});
this.push.rx.notification()
.subscribe((msg) => {
alert(msg.title + ': ' + msg.text);
});
// =============================
你是什麼捲曲命令看起來像... 這是我爲Android工作...但也不適用於iOS。
捲曲-u PRIVATE_API_KEY:-H 「內容類型:應用/ JSON」 -H 「X-離子-應用ID:2bxxxc3c」 https://push.ionic.io/api/v1/push162 -d「{ 「標記」:[「df902aff9cf46xxxxxxxxxxxxxxxxx092da76dfcb5a7fd5482e4d7e51b051f0 」],「通知「:{」alert「:」我來自行星離子。「}}'