I have the notifications working in android without any issue, but in iOS I can't figure out what seems to be the problem.
I'm using firebase_messaging plugin and in my main.dart I put:
@override
void initState() {
super.initState();
if (Platform.isIOS)
this.fbaseMessaging.requestNotificationPermissions(
IosNotificationSettings(sound: true, badge: true, alert: true),
);
}
And when the user logs in I grab the token:
fbaseMessaging.getToken().then((token) {
// Updates the user account
});
I have tested in Xcode Simulator, in a iOS device in TestFlight as well as in a released version and I never receive any notification and I have no clue how to debug where is the problem.
Followed several tutorials like:
Solved.
All I had to do was changing this:
if (Platform.isIOS)
{
this.fbaseMessaging.requestNotificationPermissions(
IosNotificationSettings(sound: true, badge: true, alert: true),
);
}
To this:
if (Platform.isIOS)
{
this.fbaseMessaging.configure();
this.fbaseMessaging.requestNotificationPermissions(
IosNotificationSettings(sound: true, badge: true, alert: true),
);
}
Seems like even though I don't use the onResume, onLaunch & onMessage the configure method has to be called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With