Swift Flatter Firebase电话认证码未通过短信发送

Swift Flatter Firebase电话认证码未通过短信发送,swift,firebase,flutter,firebase-authentication,apple-push-notifications,Swift,Firebase,Flutter,Firebase Authentication,Apple Push Notifications,我正在尝试在我的Flatter项目中启用Firebase电话身份验证,以便它实际向输入的号码发送带有身份验证码的短信 -已将APNs身份验证密钥上载到“云消息”下的Firebase项目设置中 -我还补充说: io.flutter.embedded_views_preview <string>NO</string> 这是在登录屏幕中处理整个电话身份验证过程的代码 Future<void> verifyPhone() async { final PhoneCo

我正在尝试在我的Flatter项目中启用Firebase电话身份验证,以便它实际向输入的号码发送带有身份验证码的短信

-已将APNs身份验证密钥上载到“云消息”下的Firebase项目设置中

-我还补充说:

io.flutter.embedded_views_preview
<string>NO</string>

这是在登录屏幕中处理整个电话身份验证过程的代码

Future<void> verifyPhone() async {
final PhoneCodeAutoRetrievalTimeout autoRetrieve = (String verID) {
  this.verificationID = verID;
};

final PhoneCodeSent smsCodeSent = (String verID, [int 
forceCodeResend]) {

  this.verificationID = verID;
  smsCodeDialog(context).then((value) {
  });
};

final PhoneVerificationCompleted verificationSuccess =
    (AuthCredential credential) {
};

final PhoneVerificationFailed verificationFailed =
    (AuthException exception) {
  print("verification failed this bullshit");
  if (exception.message.contains('not authorized'))
    print(
        'Something weird has gone really wrong, please do not try 
later');
  else if (exception.message.contains('Network'))
    print('Please check your internet connection and try again');
  else if (exception.message.contains("credential is invalid"))
    print("credential is invalid you jerk");
  else
    print('Something has gone horribly wrong, please try later or 
never -> ${exception.message}');
};

await _auth.verifyPhoneNumber(
    phoneNumber: "+" + dialingCode + this.phoneNo,
    timeout: const Duration(seconds: 5),
    verificationCompleted: verificationSuccess,
    verificationFailed: verificationFailed,
    codeSent: smsCodeSent,
    codeAutoRetrievalTimeout: autoRetrieve);
}


  signIn() async {
    final AuthCredential credential = 
PhoneAuthProvider.getCredential(
      verificationId: verificationID,
      smsCode: smsCode,
    );
    final FirebaseUser user = await 
_auth.signInWithCredential(credential);
    final FirebaseUser currentUser = await _auth.currentUser();
    assert(user.uid == currentUser.uid);

    Navigator.pushReplacementNamed(context, "root");
  }

您可能正在使用该问题附带的
firebase\u auth
版本,您可以在本文档中查看相关信息

我的解决方案是添加firebase_auth的分支:

firebase_auth:
git:
  url: https://github.com/collinjackson/plugins.git
  ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
  path: packages/firebase_auth
或者,您可能需要将您的
firebase\u auth
更新为
0.11.1+8版本才能获得修复


希望这能有所帮助。

发生了什么?错误是什么?另外,你能用普通的ios或安卓代码发送一个而不用Flutter吗?SMS发送有很多活动部件,将问题隔离到特定的库或工具,然后出现有意义的错误将是成功的第一步。
The UIApplicationDelegate must handle remote notification for phone 
number authentication to work.

If app delegate swizzling is disabled, remote notifications received 
by UIApplicationDelegate need to be forwarded to FIRAuth s 
canHandleNotificaton: method.
firebase_auth:
git:
  url: https://github.com/collinjackson/plugins.git
  ref: 441417c2fed0ff26bf84a49ab2c5ffd2aa5487de
  path: packages/firebase_auth