Firebase身份验证在iOS上失败(Unity,Xcode)

Firebase身份验证在iOS上失败(Unity,Xcode),ios,xcode,firebase,unity3d,authentication,Ios,Xcode,Firebase,Unity3d,Authentication,我正在尝试让Firebase Unity SDK在iOS 13设备上工作。我能够构建该项目,但问题是我无法注册或验证用户 复制步骤:(我所做的) 下载的quickstart unity/auth/testapp项目 于Unity 2019.2.20f1在iOS平台上开放 已将捆绑包ID更改为我在Firebase控制台中注册的捆绑包ID 将GoogleService-Info.plist放在Assets/Firebase文件夹下 设置解析器iOS设置选项将cocoapod添加到Xcode项目 已将

我正在尝试让Firebase Unity SDK在iOS 13设备上工作。我能够构建该项目,但问题是我无法注册或验证用户

复制步骤:(我所做的)

  • 下载的quickstart unity/auth/testapp项目
  • 于Unity 2019.2.20f1在iOS平台上开放
  • 已将捆绑包ID更改为我在Firebase控制台中注册的捆绑包ID
  • 将GoogleService-Info.plist放在Assets/Firebase文件夹下
  • 设置解析器iOS设置选项将cocoapod添加到Xcode项目
  • 已将最新的Firebase Auth软件包6.10.0从dotnet4文件夹导入项目
  • 建造
  • 我在Xcode项目中看到的:

  • 播客文件内容如下所示:
  • GoogleService-Info.plist也在Xcode项目层次结构中
  • 使用iOS 13在我的iPhone 8上签名并构建

    结果:当我尝试填写字段email和password并按下按钮“Create User”时,该按钮将调用以下方法:

    // Create a user with the email and password.
        public Task CreateUserWithEmailAsync() {
          DebugLog(String.Format("Attempting to create user {0}...", email));
          DisableUI();
    
          // This passes the current displayName through to HandleCreateUserAsync
          // so that it can be passed to UpdateUserProfile().  displayName will be
          // reset by AuthStateChanged() when the new user is created and signed in.
          string newDisplayName = displayName;
          return auth.CreateUserWithEmailAndPasswordAsync(email, password)
            .ContinueWithOnMainThread((task) => {
              EnableUI();
              if (LogTaskCompletion(task, "User Creation")) {
                var user = task.Result;
                DisplayDetailedUserInfo(user, 1);
                return UpdateUserProfileAsync(newDisplayName: newDisplayName);
              }
              return task;
            }).Unwrap();
        }
    
    我在设备屏幕和Xcode日志中也看到此错误:

    AuthError.Failure: Firebase.FirebaseException: An internal error has occurred, print and inspect the error details for more information.
    
    以下是来自Xcode的完整日志:

    我还试着做:

  • 在iOS版本较低的设备上构建
  • 尝试使用Unity 2019.1.11和2019.1.13版本构建
  • 试图将GoogleService-Info.plist直接导入Xcode项目
  • 已试用Firebase SDK 6.8.0版本
  • 试图手动添加[FIRApp configure]
  • 什么都没用
  • Firebase控制台为project配置,包含两个应用程序android和iOS,具有不同的捆绑ID。经过多次测试,安卓版本工作正常

    统一编辑器版本:2019.2.20f1

    Firebase Unity SDK版本:6.10.0

    正在使用的Firebase插件:Auth

    我们正在使用的其他SDK(Facebook、AdMob等):无

    我们正在使用Unity编辑器的平台:Mac

    我们的目标平台:iOS

    脚本运行时:IL2CPP

    Xcode版本:11(最新)

    CocoaPods:最新版本

    您需要检查您的Xcode Info.Plist文件,其中需要添加用于google登录的密钥。


    另请参阅您的日志第3行需要删除一个密钥。

    至少我能够解决此问题。下面是我如何修复它的描述

    正如我前面提到的,Unity是这样导出PodFile的:

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '9.0'
    
    target 'Unity-iPhone' do
      pod 'Firebase/Auth', '6.14.0'
      pod 'Firebase/Core', '6.14.0'
    end
    
    这意味着Firebase Unity SDK 6.10.0需要Pods版本6.14.0。 用这个吊舱建造时,我看到上面提到的错误:

    [SA LOG] CreateUserWithEmailAndPasswordAsync encountered an error: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred, print and inspect the error details for more information.
       --- End of inner exception stack trace ---
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: An internal error has occurred, print and inspect the error details for more information.
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) Firebase.FirebaseException: An internal error has occurred, print and inspect the error details for more information.<---
    <---
    
    在构建之后,我能够得到人类可读的错误,上面写着:

    Response body: {
      "error": {
        "code": 400,
        "message": "API key expired. Please renew the API key.",
        "status": "INVALID_ARGUMENT",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.Help",
            "links": [
              {
                "description": "Google developer console API key",
                "url": "https://console.developers.google.com/project/37062923653/apiui/credential"
              }
            ]
          }
        ]
      }
    }
    
    正如错误所说,我在谷歌开发者控制台中更新了API密钥,现在一切正常

    结论:

    这与Firebase Unity SDK 6.10.0和6.8.0无关,也与解析DLL无关。问题是Firebase吊舱的旧版本6.14.0没有给出人类可读的错误,所以我无法理解到底发生了什么。在使用最新的Firebase吊舱后,我能够理解错误原因

    感谢所有回答我问题的人。

    我在Unity控制台中看到“CreateUserWithEmailAndPasswordAsync遇到错误:System.AggregateException:发生内部错误。”

    为了解决这个问题,我关闭了Unity,进行了重要的改变,并重新打开了Unity。在出现的弹出窗口中,我单击了“启用”

    同时,我还转到Firebase控制台()中的项目设置并启用了邮件注册。在视频教程中也有建议,但在书面教程中没有


    之后,问题就解决了。

    谢谢您的回复。在这个项目中,我只使用电子邮件和密码登录功能,我需要为谷歌登录添加密钥吗?还有我日志中的第三行,你是说这一行吗?要禁用屏幕报告,请在需要添加键的Info.plies中将标志FirebaseScreenReportingEnabled设置为NO(布尔值),同时为FirebaseScreenReportingEnabled键设置NO链接已经存在,并自动添加它。在Info.plist中将标志FirebaseScreenReportingEnabled设置为NO(布尔值)也没有帮助。
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '9.0'
    
    target 'Unity-iPhone' do
      pod 'FirebaseAnalytics', '~> 6.2'
      pod 'FirebaseAuth', '~> 6.4'
      pod 'FirebaseCore', '~> 6.6'
    end
    
    Response body: {
      "error": {
        "code": 400,
        "message": "API key expired. Please renew the API key.",
        "status": "INVALID_ARGUMENT",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.Help",
            "links": [
              {
                "description": "Google developer console API key",
                "url": "https://console.developers.google.com/project/37062923653/apiui/credential"
              }
            ]
          }
        ]
      }
    }