【问题标题】:Unity3D 5.3, Facebook SDK does not work in iOSUnity3D 5.3,Facebook SDK 在 iOS 中不起作用
【发布时间】: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


    【解决方案1】:

    fb Unity sdk 可能有问题。 This is how you integrate FB SDK in iOS。因此,您可能应该在 xCode 中手动实现第 3 步。如果它抛出另一个类似的错误,只需从错误日志中复制方案并再次将其添加到 plist。

    【讨论】:

    • 老兄,你的评论有很多问题......只是...... CMD + Shift + B 生成一个xCode项目:/
    • 我说编译后的项目人类无法阅读。 是的,它在 XCode 中打开,是的,它编译到 iOS。这并不意味着人类可以进入并更改代码。
    • 我已经尝试过你所说的,Nika Kasradze。不幸的是,它没有帮助 =(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 2011-05-06
    • 1970-01-01
    • 2015-07-17
    • 2014-06-23
    相关资源
    最近更新 更多