Skip to content

flutter_apns will casue error when initializing Firebase #99

@kidozh

Description

@kidozh

As is illustrated in the title, the plugin will cause the following error when firebase is initilized:

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0      FirebaseCoreHostApi.initializeCore (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:199:7)
<asynchronous suspension>
#1      MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:29:44)
<asynchronous suspension>
#2      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:73:7)
<asynchronous suspension>
#3      Firebase.initializeApp (package:firebase_core/src/firebase.dart:40:31)
<asynchronous suspension>
#4      main (package:fulcrum/main.dart:18:3)
<asynchronous suspension>

the error comes from the line

await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

In this issue, the author points out that flutter_apns doesn't using the upgraded version of flutterfire and make it happen.

I upgraded all the dependencies including flutter_apns (1.6.0) and firebase_messaging (12.0.1) and this error still occurs. After removing flutter_apns, the firebase can normally get initialized without any error. When adding it back to the dependencies and without adding any code, the Unhandled Exception shows up when initializing firebase messaging.

So there is a conflict between flutter_apns and firebase_messaging but I don't know the exact reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions