Skip to content

🐛 [firebase_messaging] getToken() hangs forever on iOS #3778

Closed
@emvaized

Description

@emvaized

Bug report

Describe the bug
The initialization code on iOS fails to execute.

Steps to reproduce

   print('configuring fcm...');
   _firebaseMessaging.configure();

   print('requesting ios permissions...');
   _firebaseMessaging.requestNotificationPermissions();

   print('getting fcm token...');
   token = await _firebaseMessaging.getToken();

   print('finished getting fcm token');
   print("FirebaseMessaging token: $token");

finished getting fcm token never gets printed in console, not on iOS emulator nor on real device.

Expected behavior

On Android the same code works just fine with no errors.

Additional context

I tried the solution suggested here by restricting access to Firebase Installations API in Google Cloud Console specifically for iOS key, but it seems to not help.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all
details, run flutter doctor
-v):
[✓] Flutter (Channel stable,
    1.22.0, on Mac OS X
    10.15.7 19H2, locale
    ru-UA)
 
[✓] Android toolchain -          develop for Android          devices (Android SDK
    version 30.0.0)
[✓] Xcode - develop for iOS
    and macOS (Xcode 11.7)
[✓] Android Studio (version
    4.0)
[✓] VS Code (version 1.49.2)
[✓] Connected device (1
    available)

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
firebase_messaging: 7.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleIssue with no recent activityblocked: customer-responseWaiting for customer response, e.g. more information was requested.type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions