Ionic framework IONIC v2,iOS推送,如何捕获寄存器上的错误
我正在做一个IONICV2项目。iOS推送通知。我在安卓上做这个。。。。但不是iOS。应用程序工作。。但是…这个.push.register()永远不会发生。我正在寻找一种方法来返回一个错误或下面的一些响应代码,以找出为什么这不是用令牌响应。 谢谢Ionic framework IONIC v2,iOS推送,如何捕获寄存器上的错误,ionic-framework,apple-push-notifications,Ionic Framework,Apple Push Notifications,我正在做一个IONICV2项目。iOS推送通知。我在安卓上做这个。。。。但不是iOS。应用程序工作。。但是…这个.push.register()永远不会发生。我正在寻找一种方法来返回一个错误或下面的一些响应代码,以找出为什么这不是用令牌响应。 谢谢 以防有人对使用此代码的地方感兴趣。 它是app.components.ts的爱奥尼亚v2代码的修改版本 此代码用于注册和处理推送通知。 我遇到的问题是,代码将编译并在物理iOS设备上启动。但不会退还任何代币。因此.Catch将返回一个错误。在我的情况
以防有人对使用此代码的地方感兴趣。 它是app.components.ts的爱奥尼亚v2代码的修改版本 此代码用于注册和处理推送通知。 我遇到的问题是,代码将编译并在物理iOS设备上启动。但不会退还任何代币。因此.Catch将返回一个错误。在我的情况下,它返回的是找不到电话间隙插件。仍然在检查这个问题,但我认为真正的答案是我没有正确设置离子代币
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);});
通常我不做离子。。。大部分是本地人。请评论
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);});