简体   繁体   English

Unity Firebase Invites 抛出异常ApplicationException: internal::IsInitialized()

[英]Unity Firebase Invites throws exception ApplicationException: internal::IsInitialized()

I'm trying to add Firebase Invites to my Unity game.我正在尝试将 Firebase 邀请添加到我的 Unity 游戏中。 I've followed all the tutorial steps and have set up seems like everything.我已经按照所有的教程步骤进行了设置,一切似乎都已完成。 But when I try to run the code from tutorial to send an invite, I'm getting an exception:但是当我尝试运行教程中的代码来发送邀请时,我遇到了一个异常:

ApplicationException: internal::IsInitialized()
 at Firebase.FutureBase.status ()
 at Firebase.Invites.SendInviteFuture.GetTask (Firebase.Invites.SendInviteFuture fu)
 at Firebase.Invites.FirebaseInvites.SendInviteAsync (Firebase.Invites.Invite invite)
...

The code is:代码是:

void Start()
{
    Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
    {
        dependencyStatus = task.Result;
        if (dependencyStatus == Firebase.DependencyStatus.Available)
            InitializeFirebase();
        else
            Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
    });
}

void InitializeFirebase()
{
    Firebase.Invites.FirebaseInvites.InviteReceived += OnInviteReceived;
    Firebase.Invites.FirebaseInvites.InviteNotReceived += OnInviteNotReceived;
    Firebase.Invites.FirebaseInvites.ErrorReceived += OnErrorReceived;
}

public void ShowInviteBox(System.Action<bool> callback)
{
  var invite = new Firebase.Invites.Invite() {
    TitleText = "Invites Test App",
    MessageText = "Please try my app! It's awesome.",
    CallToActionText = "Download it for FREE",
    DeepLinkUrl = new System.Uri("http://google.com/abc")
  };
  Firebase.Invites.FirebaseInvites.SendInviteAsync(invite).ContinueWith(HandleSentInvite);
}

I use:我用:

  • Unity 2017.3.0f3统一 2017.3.0f3
  • Google Play Game Services Plugin for Unity 0.9.50适用于 Unity 0.9.50 的 Google Play 游戏服务插件
  • Firebase Invites 4.4.3 Firebase 邀请 4.4.3
  • Appodeal 2.8.18 nodex Appodeal 2.8.18 nodex
  • Game Analytics 3.10.4游戏分析 3.10.4

Any help would be highly appreciated!任何帮助将不胜感激!

I think I found a solution.我想我找到了解决办法。

That error occurs when use "SendEvent()" before firebase initialized.在 firebase 初始化之前使用“SendEvent()”时会发生该错误。

I solved error by below code.我通过以下代码解决了错误。

private void InitializeFirebase()
{
    Debug.Log("FirebaseManager : Enabling data collection.");
    FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);

    Debug.Log("FirebaseManager : Set user properties.");
    // Set the user's sign up method.
    FirebaseAnalytics.SetUserProperty(
      FirebaseAnalytics.UserPropertySignUpMethod,
      "Google");
    // Set the user ID.
    FirebaseAnalytics.SetUserId("uber_user_510");
    // Set default session duration values.
    FirebaseAnalytics.SetMinimumSessionDuration(new TimeSpan(0, 0, 10));
    FirebaseAnalytics.SetSessionTimeoutDuration(new TimeSpan(0, 30, 0));

    //THIS IS SOLUTION!!!!
    Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => 
    {
        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);
    });
}

Enter your first "SendEvent" in the CheckAndFixDependenciesAsync().在 CheckAndFixDependenciesAsync() 中输入您的第一个“SendEvent”。

Hope this was helpful.希望这对您有所帮助。


After I finded and installed Older version of firebase(6.15.2), The older version of firebase showed me a helpful error message...在我找到并安装旧版本的 firebase(6.15.2) 之后,旧版本的 firebase 向我显示了一条有用的错误消息......

"don't call firebase functions before check dependencies has finished" “在检查依赖项完成之前不要调用 firebase 函数”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Unity + Firebase Storage for iOS 授权异常 - Unity + Firebase Storage for iOS giving authorization Exception 防止 android 可调用时应用程序崩溃 firebase function 抛出异常 - Prevent android app crash when callable firebase function throws exception FlutterFire:调用云 function 会引发没有详细信息的内部错误 - FirebaseFunctionsException [firebase_functions/17999] - FlutterFire: Calling cloud function throws an internal error with no details - FirebaseFunctionsException [firebase_functions/17999] 我们如何解决 flutter 应用程序中的 firebase 函数内部异常? - How can we resolve firebase functions INTERNAL exception in a flutter app? Firebase - 使用 Jest 进行测试会抛出错误“内部断言失败:需要一个 class 定义” - Firebase - Testing with Jest throws error "INTERNAL ASSERTION FAILED: Expected a class definition" 将Firebase Crashlytics SDK添加到我的android app中,是否会报unity异常? - Add the Firebase Crashlytics SDK to my android app, can it report the exception of unity? 从 android 应用调用异步 Firebase function 时出现“内部”异常 - Getting “INTERNAL” exception when an async Firebase function is called from android app 出现错误:抛出“Google.GoogleSignIn+SignInException”类型的 DeveloperError 异常 --- 统一,firebase,谷歌登录? - Got Error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown --- unity, firebase, google login? unity firebase 通知自定义图片 - Unity firebase notifications custom image 如何在 Unity 中使用异步 Firebase - How to use async in Unity with Firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM