我终于成功实现了动态链接(手动创建并通过Rest API缩短),该工作正常并在点击时打开游戏。
事情是,一旦打开,我就无法从中检索任何东西。我已经复制了示例代码from the documentation,添加了一些日志,但没有。这是我的代码,
// When the app starts, check to make sure that we have
// the required dependencies to use Firebase, and if not,
// add them if possible.
void Start()
{
dependencyStatus = Firebase.FirebaseApp.CheckDependencies();
if (dependencyStatus != Firebase.DependencyStatus.Available)
{
Firebase.FirebaseApp.FixDependenciesAsync().ContinueWith(task => {
dependencyStatus = Firebase.FirebaseApp.CheckDependencies();
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
InitializeFirebase();
} else
{
Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
} else {
InitializeFirebase();
}
}
// Set the listeners for the various Invite received events.
void InitializeFirebase()
{
Firebase.Invites.FirebaseInvites.InviteReceived += OnInviteReceived;
Firebase.Invites.FirebaseInvites.InviteNotReceived += OnInviteNotReceived;
Firebase.Invites.FirebaseInvites.ErrorReceived += OnErrorReceived;
Debug.Log("Invites initialized");
}
void OnInviteReceived(object sender, Firebase.Invites.InviteReceivedEventArgs e)
{
Debug.Log ("OnInviteRecieved");
if (e.InvitationId != "")
{
Debug.Log("Invite received: Invitation ID: " + e.InvitationId);
Firebase.Invites.FirebaseInvites.ConvertInvitationAsync(e.InvitationId).ContinueWith(HandleConversionResult);
}
if (e.DeepLink.ToString () != "")
{
Debug.Log ("Invite received: Deep Link: " + e.DeepLink);
PrepareLevel (e.DeepLink.ToString ());
}
}
void OnInviteNotReceived(object sender, System.EventArgs e)
{
Debug.Log ("OnInviteNotReceived");
Debug.Log("No Invite or Deep Link received on start up");
}
void OnErrorReceived(object sender, Firebase.Invites.InviteErrorReceivedEventArgs e)
{
Debug.Log ("OnErrorReceived");
Debug.LogError("Error occurred received the invite: " + e.ErrorMessage);
}
void HandleConversionResult(Task convertTask)
{
Debug.Log ("HandleConversionResult");
if (convertTask.IsCanceled) {
Debug.Log("Conversion canceled.");
} else if (convertTask.IsFaulted) {
Debug.Log("Conversion encountered an error:");
Debug.Log(convertTask.Exception.ToString());
} else if (convertTask.IsCompleted) {
Debug.Log("Conversion completed successfully!");
}
}
这是我从设备(iPhone6S)获得的日志。
此外,"邀请已初始化"已经提示,当从动态链接打开应用程序时它仍然存在(它永远不会被销毁)。
哦,我通过facebook messenger app打开了链接。
非常感谢所有帮助。