我想登录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中一切都是正确的。
答案 0 :(得分:0)