flutter: If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's

被刻印的时光 ゝ 提交于 2020-06-28 04:45:20

问题


When i want to use sms auth with firebase the app fails only on iOS

The APN certificate is alredy configured on firebase and FirebaseAppDelegateProxyEnabled is NO in Info.plist. The error is occuring during the verifyPhoneNumber method.

Here is the flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.7.0, on Mac OS X 10.14.5 18F132, locale en-PE)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.36.1)
[✓] Connected device (1 available)

Here is my code

void sendSms(String fullNumber) {
    FirebaseAuth.instance.verifyPhoneNumber(
      phoneNumber: fullNumber,
      timeout: Duration(minutes: 1),
      verificationCompleted: (AuthCredential phoneAuthCredential) async {
        _smsController?.add('loading');
        FirebaseUser firebaseUser = await FirebaseAuth.instance
            .signInWithCredential(phoneAuthCredential);
        _verifyUser(firebaseUser);
      },
      verificationFailed: (err) {
        print(err.message);
        print(err.code);
        _smsController?.add('UNKNOWN_ERROR');
      },
      codeSent: (verificationId, [forceResendingToken]) {
        _verificationId = verificationId;
        _smsController?.add('code_sent');
      },
      codeAutoRetrievalTimeout: (verificationId) {},
    );
  }

And the error messages:

flutter: If app delegate swizzling is disabled, remote notifications received by UIApplicationDelegate need to be forwarded to FIRAuth's canHandleNotificaton: method.

flutter: verifyPhoneNumberError


回答1:


Solution :

I found this in flutter repository and currently works.

Replace the current firebase_auth version with

firebase_auth:
    git:
      url: https://github.com/collinjackson/plugins.git
      ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
      path: packages/firebase_auth


来源:https://stackoverflow.com/questions/57048800/flutter-if-app-delegate-swizzling-is-disabled-remote-notifications-received-by

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!