我正在尝试将 Firebase 邀请添加到我的 Unity 游戏中。我已按照所有教程步骤进行操作,并且设置似乎一切正常。但是当我尝试运行教程中的代码来发送邀请时,我遇到了一个异常:
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)
...
代码是:
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);
}
我用:
- 统一2017.3.0f3
- 适用于 Unity 0.9.50 的 Google Play 游戏服务插件
- Firebase 邀请 4.4.3
- Appodeal 2.8.18 节点
- 游戏分析 3.10.4
任何帮助将不胜感激!