在我的 firebase ios 应用程序上调用 verifyPhoneNumber 会抛出 "internal-error"

Calling verifyPhoneNumber on my firebase ios app throws "internal-error"

我在我的 flutter 应用程序中使用 phone 号码进行身份验证。虽然它在 Android 上工作正常,但我在 ios:

上收到一条错误消息
_firebaseAuth.verifyPhoneNumber(
        phoneNumber: phoneNumber,
        timeout: ...
        verificationCompleted: ...
        verificationFailed: verificationFailed,
        codeSent: codeSent
...

static final PhoneVerificationFailed verificationFailed =
      (FirebaseAuthException authException) {
    Log.e(authException.message);
    Log.e(authException.code);
}

代码和消息都只说这是一个内部错误,没有任何细节。

在我将应用程序移至新的 Appel 开发者帐户之前,一切正常。这意味着团队ID已更改。

我也在这里更改了团队ID:

我重新下载了google.plist,放到runner目录下

google云平台也显示正确的团队id:

相同的团队 ID 显示在“签名和功能”-> 签名证书的 xcode 中。

更改团队 ID 也会导致无法访问钥匙串:

ITMS-90076: Potential Loss of Keychain Access - The previous version of software has an application-identifier value of ['MKYCXH32H9.com.sykori.framr2'] and the new version of software being submitted has an application-identifier of ['75GNKYT7HC.com.sykori.framr2']. This will result in a loss of keychain access.

但我认为唯一的意思是无法再访问以前版本的数据。

既然你说这个问题是在你切换开发者帐户后出现的,那么可以安全地假设这个问题是由配置错误引起的。

Firebase Phone Auth for iOS docs 比您上面描述的多指定几个步骤,即:

  1. 将您的 APNs 身份验证密钥上传到 Firebase。如果您更改了开发者帐户,APN 授权密钥也会更改。
  2. 要使 Firebase SDK 能够使用 reCAPTCHA,您需要将 REVERSED_CLIENT_ID 添加到配置页面上的 URL Schemes 框中。

我认为这两个步骤可以解决问题,但只是为了确保您可以完成文档中的所有步骤以确保没有遗漏任何其他内容。