Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Facebook帖子无法在unity的设备中使用Facebook应用程序_Android_Facebook_Facebook Graph Api_Facebook Sdk 3.0_Facebook Unity Sdk - Fatal编程技术网

Android Facebook帖子无法在unity的设备中使用Facebook应用程序

Android Facebook帖子无法在unity的设备中使用Facebook应用程序,android,facebook,facebook-graph-api,facebook-sdk-3.0,facebook-unity-sdk,Android,Facebook,Facebook Graph Api,Facebook Sdk 3.0,Facebook Unity Sdk,我正在团结一致地工作 我尝试使用Facebook SDK插件将分数发布到Facebook墙上 虽然我使用了一个安装了Facebook官方应用程序的设备(Nexus7,MotoG),但是FB.Feed()方法不起作用,并且该设备中没有出现对话框 我试过这个解决方案,但对我不起作用 这是我的fblogin脚本: public class fblogin : MonoBehaviour { private string status = "Ready"; pr

我正在团结一致地工作

我尝试使用Facebook SDK插件将分数发布到Facebook墙上

虽然我使用了一个安装了Facebook官方应用程序的设备(Nexus7,MotoG),但是
FB.Feed()
方法不起作用,并且该设备中没有出现对话框

我试过这个解决方案,但对我不起作用

这是我的
fblogin
脚本:

    public class fblogin : MonoBehaviour
{

        private string status = "Ready";
        private string lastResponse = "";
        public GUIStyle textStyle = new GUIStyle ();
        private Texture2D lastResponseTexture;
        private bool isInit = false;

        // Use this for initialization
        void Start ()
        {

        }

        // Update is called once per frame
        void Update ()
        {

        }

        void OnGUI ()
        {

                if (GUI.Button (new Rect (10, 10, 300, 100), "FB.Init")) {
                        CallFBInit ();
                        status = "FB.Init() called with " + FB.AppId;

                }

                if (GUI.Button (new Rect (100, 100, 300, 100), "Login")) {
                        //FB.Init (OnInitComplete, OnHideUnity);
                        //status = "FB.Init() called with " + FB.AppId;
                        CallFBLogin ();
                }

                if (GUI.Button (new Rect (200, 200, 300, 100), "Share")) {
                        //FB.Init (OnInitComplete, OnHideUnity);
                        //status = "FB.Init() called with " + FB.AppId;
                        onBragClicked ();      
                }





        }

        private void onBragClicked ()
        {                                                                                                                            
                //Util.Log ("onBragClicked");                                                                                            
                FB.Feed (
                linkCaption: "I just smashed " + "15" + " friends! Can you beat it?",               
                picture: "http://www.friendsmash.com/images/logo_large.jpg",                                                     
                linkName: "Checkout my Friend Smash greatness!",                                                                 
                link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest")       
                );                                                                                                               
        }

        private void CallFBInit ()
        {
                FB.Init (OnInitComplete, OnHideUnity);
        }

        private void OnInitComplete ()
        {
                Debug.Log ("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
                isInit = true;
        }

        private void OnHideUnity (bool isGameShown)
        {
                Debug.Log ("Is game showing? " + isGameShown);
        }

        private void CallFBLogin ()
        {
                FB.Login ("email,publish_actions", LoginCallback);
        }

        void LoginCallback (FBResult result)
        {
                if (result.Error != null)
                        lastResponse = "Error Response:\n" + result.Error;
                else if (!FB.IsLoggedIn) {
                        lastResponse = "Login cancelled by Player";
                } else {
                        lastResponse = "Login was successful!";
                }
        }
      }

有人能帮忙吗?

把这个放在你的脚本中,在inspector中填写所有的FeedParameters,我想这是因为你没有在feed中指定回调,而是把这个放在脚本中,在inspector中填写参数,其中一些是必需的,否则feed甚至不会出现

#region FB.Feed() example

    public string FeedToId = "";
    public string FeedLink = "";
    public string FeedLinkName = "";
    public string FeedLinkCaption = "";
    public string FeedLinkDescription = "";
    public string FeedPicture = "";
    public string FeedMediaSource = "";
    public string FeedActionName = "";
    public string FeedActionLink = "";
    public string FeedReference = "";
    public bool IncludeFeedProperties = false;
    private Dictionary<string, string[]> FeedProperties = new Dictionary<string, string[]>();

    void Callback(FBResult result)
    {
        //lastResponseTexture = null;
        // Some platforms return the empty string instead of null.
        //if (!String.IsNullOrEmpty(result.Error)){
            //lastResponse = "Error Response:\n" + result.Error;
        //}
        //else if (!ApiQuery.Contains("/picture")){
            //lastResponse = "Success Response:\n" + result.Text;
        //}
        //else
        //{
            //lastResponseTexture = result.Texture;
            //lastResponse = "Success Response:\n";
        //}
    }

    private void CallFBFeed()
    {
        Dictionary<string, string[]> feedProperties = null;
        if (IncludeFeedProperties)
        {
            feedProperties = FeedProperties;
        }
        FB.Feed(
            toId: FeedToId,
            link: FeedLink,
            linkName: FeedLinkName,
            linkCaption: FeedLinkCaption,
            linkDescription: FeedLinkDescription,
            picture: FeedPicture,
            mediaSource: FeedMediaSource,
            actionName: FeedActionName,
            actionLink: FeedActionLink,
            reference: FeedReference,
            properties: feedProperties,
            callback: Callback
            );
    }

    #endregion
#region FB.Feed()示例
公共字符串FeedToId=“”;
公共字符串FeedLink=“”;
公共字符串FeedLinkName=“”;
公共字符串FeedLinkCaption=“”;
公共字符串FeedLinkDescription=“”;
公共字符串FeedPicture=“”;
公共字符串FeedMediaSource=“”;
公共字符串FeedActionName=“”;
公共字符串FeedActionLink=“”;
公共字符串FeedReference=“”;
public bool IncludeFeedProperties=false;
私有字典FeedProperties=新字典();
无效回调(FBResult结果)
{
//lastResponseTexture=null;
//有些平台返回空字符串而不是null。
//如果(!String.IsNullOrEmpty(result.Error)){
//lastResponse=“错误响应:\n”+结果。错误;
//}
//如果(!ApiQuery.Contains(“/picture”),则为else{
//lastResponse=“成功响应:\n”+结果.Text;
//}
//否则
//{
//lastResponseTexture=result.Texture;
//lastResponse=“成功响应:\n”;
//}
}
私有void CallFBFeed()
{
Dictionary feedProperties=null;
if(IncludeFeedProperties)
{
feedProperties=feedProperties;
}
饲料(
toId:FeedToId,
链接:FeedLink,
linkName:FeedLinkName,
linkCaption:FeedLinkCaption,
linkDescription:FeedLinkDescription,
图片:FeedPicture,
mediaSource:FeedMediaSource,
actionName:FeedActionName,
actionLink:FeedActionLink,
参考:FeedReference,
属性:feedProperties,
回调:回调
);
}
#端区

您能够登录吗?是的,如果我已经注销,则会出现登录框并成功登录,但…提要对话框不会出现…请将其放入脚本中,并在需要提要时调用CallFBFeed(),但首先在inspectorok中填写所需的字段,是的…但是如果我尝试卸载facebook应用程序,并且之后,它成功发布在fb墙上。我不知道,idk(我不知道)当fb应用程序未安装时它工作正常,但当fb应用程序安装时它不工作,请查看我通过fb应用程序登录时得到的响应是“用户取消登录”…让我们