Closed Saqib92 closed 2 years ago
I was getting this error too. I moved my call to FCM.getToken() to the callback for PushNotifications.addListener('registration') and that made this error go away but I am still not getting notifications on iOS. Tried sending notifications by device token ID and by firebase topic ID to no avail.
hello there. it's impossible to know without a reproducible example, where we can download and try.
it works using the example application
can you please try on both latest capacitor + plugin?
here is the repo: https://github.com/Saqib92/cap-push-issue
I was getting this error too. I moved my call to FCM.getToken() to the callback for PushNotifications.addListener('registration') and that made this error go away but I am still not getting notifications on iOS. Tried sending notifications by device token ID and by firebase topic ID to no avail.
this is how i made it Work:
PushNotifications.requestPermissions().then((permission) => {
if (permission.receive == "granted") {
// Register with Apple / Google to receive push via APNS/FCM
if(Capacitor.getPlatform() == 'ios'){
PushNotifications.register().then((res)=>{
console.log('From Regisiter Promise', res)
})
PushNotifications.addListener('registration', (token: Token)=>{
FCM.getToken().then((result) => {
this.remoteToken = result.token;
}).catch((err) => console.log('i am Error' , err));
})
}else{
FCM.getToken().then((result) => {
this.remoteToken = result.token;
}).catch((err) => console.log('i am Error' , err));
}
} else {
// No permission for push granted
alert('No Permission for Notifications!')
}
});
Describe the bug Everythign is Perfectly Works on Android but in IOS i am having Following Error:
APNS device token not set before retrieving FCM Token for Sender ID 'mySenderId'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
Expected behavior It should work fine I have setup everything correctly (that's what i assume :p)
Desktop (please complete the following information):
iOS
Smartphone (please complete the following information):
iPhone12
iOS14.5
Followed this This Tutorial also researched from other resources e.g: this