Flutter FCM iOS Issue - APNS device token not set before retrieving FCM Token

6,023

Solution 1

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:

  1. Go to xcode
  2. Select runner
  3. Signing & Capabilities
  4. Check debug and release capabilities you need to have background modes and push notification

push notification capability

https://firebase.flutter.dev/docs/messaging/apple-integration

Solution 2

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

Share:
6,023
Karthikeyan P
Author by

Karthikeyan P

Updated on December 28, 2022

Comments

  • Karthikeyan P
    Karthikeyan P over 1 year

    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.