I am using firebase_messaging v9.0.1 in my Flutter application. On configuring this library based on the https://pub.dev/packages/firebase_messaging/example, I am able to receive the notification for android in both foreground and background states. But the same for iOS is not working. I am getting the below error,
APNS device token not set before retrieving FCM Token for Sender ID ''. 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.
My iOS device is connected to internet and there were no network related issues while running this.
Do I want to call any other function apart from FirebaseMessaging.instance.getToken() for iOS? Please help.
Thanks.
Instead, you should expect that the device token can change at any time. Because your app might unexpectedly get a new token, you should record that token for the user every time your app launches.
By default, the FCM SDK generates a registration token for the client app instance on app launch. Similar to the APNs device token, this token allows you to send targeted notifications to any particular instance of your app.
" APNS device token not set before retrieving FCM Token for Sender ID 'XXXXXXXXXXXXX'. 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."
Flutter - apns device token not set before retrieving fcm token Can not generate a debug token for Firebase Storage with App Check Your bucket has not been set up properly for Firebase Storage a release for internal test in google play not retrieving or uploading any data from/to firebase
By default, the FCM SDK generates a registration token for the client app instance on app launch. Similar to the APNs device token, this token allows you to send targeted notifications to any particular instance of your app.
APNSToken = deviceToken; After the FCM registration token is generated, you can access it and listen for refresh events using the same methods as with swizzling enabled. When an FCM registration token is generated, the library uploads the identifier and configuration data to Firebase.
I had the same problem, I went step by step again with firebase documentation and realize that the push notification capability was missing on debug and release modes.
Steps to solve the issue:
https://firebase.flutter.dev/docs/messaging/apple-integration
The way I solve this issue, instead of running the application thru debug mode, I archive the app and download it thru ad hoc and somehow this solves the issue
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