我有同样的问题...你可以确认你实际上获得一个令牌的注册?
如果不是...代码片断得到一个线索有关,如果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“:”我来自行星离子。“}}'