【发布时间】:2016-03-20 03:22:16
【问题描述】:
我想登录 Facebook 并分享一些信息。这是代码
using UnityEngine;
using System.Collections.Generic;
using Facebook.Unity;
using System;
public class FBManager : MonoBehaviour {
void Awake()
{
FB.Init(Init);
}
void Init()
{
Debug.Log("initialized");
}
public void Share()
{
if (FB.IsLoggedIn)
{
Debug.Log("going to call FB.ShareLink()");
FB.ShareLink(new Uri("http://www.google.com/"), "google", "google super search engine", null,ShareCallback);
}
else
{
Debug.Log("going to call Login()");
Login();
}
}
private void Login()
{
FB.LogInWithPublishPermissions(new List<string>() { "publish_actions" }, LoginCallback);
}
void LoginCallback(ILoginResult result)
{
Debug.Log("error: " + result.Error);
if (result.Error != null)
Debug.LogError(result.Error);
else
{
Debug.Log("logged? " + FB.IsLoggedIn);
Share();
}
}
void ShareCallback(IShareResult result)
{
if (result.Error != null)
Debug.LogError(result.Error);
else
Debug.Log("sharing done");
}
}
当它调用 Login() 方法时会报错
2015-12-14 17:36:25.910 TheMyAppName[741:307812] *** 终止应用 由于未捕获的异常“InvalidOperationException”,原因:“fb0 是 未注册为 URL 方案。请将其添加到您的 Info.plist'中
我该如何解决?仅当我使用 Unity 5.3 制作 XCODE 项目时才会发生这种情况,在 Unity 5.2 中一切正常。
【问题讨论】:
标签: ios xcode facebook unity3d