这个错误是我在android上运行时发生的。
我正在使用@ionic native/push从nodejs服务器接收push noti。
这是我的配置:
组件.ts:
initPushNotification() {
const options: PushOptions = {
android: {},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
}
};
const pushObject: PushObject = this.push.init(options);
pushObject.subscribe('topic').then(() => {
console.log('subscribe success to topic')
}).catch((e) => {
console.log(e)
})
pushObject.on('registration').subscribe((data: any) => {
console.log('device token -> ' + data.registrationId);
//TODO - send device token to server
});
pushObject.on('notification').subscribe((notification: any) => {
console.log('Received a notification', notification)
});
pushObject.on('error').subscribe(error => console.error('Error with Push plugin' + error));
}
我的app.modules.ts:
import { Push, PushObject } from '@ionic-native/push';
providers: [
...
Push, PushObject,
...]
有人能帮我吗?
最佳答案
不要在提供者数组中包含PushObject
,只包含Push
类(因为这是提供者):
import { Push } from '@ionic-native/push';
providers: [
...
Push,
...]
关于angular - 未捕获的错误:无法解析PushObject的所有参数:(?),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46742272/