-3

나는 Unity에서 일하고 있습니다.페이스 북이 페이스 북의 응용 프로그램과 함께 작동하지 않습니다.

Facebook SDK 플러그인을 사용하여 Facebook 벽에 점수를 게시하려고했습니다.

공식적인 Facebook 응용 프로그램이 설치된 장치 (Nexus7, MotoG)를 사용했지만 FB.Feed() 메서드가 작동하지 않고 대화 상자가 장치에 나타나지 않습니다.

Facebook Unity SDK on Android - Login fails when FB App installed에서 해결책을 시도했지만 나에게 도움이되지 않습니다.

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!"; 
       } 
     } 
     } 

누군가가 도와 드릴까요 : 여기

fblogin 스크립트입니다?

+0

전혀 로그인 할 수 있습니까? – JRowan

+0

예. 로그인 상자보다 이미 로그 아웃 한 경우 성공적으로 로그인되었지만 피드 대화 상자가 나타나지 않습니다. –

+0

스크립트에 해당 내용을 입력하고 피드를 표시하려면 CallFBFeed()를 호출하십시오. 먼저 검사관에서 원하는 feilds를 기입하십시오. – JRowan

답변

1

귀하의 스크립트 안에 이것을 넣고 검사관이 FeedParameters를 모두 채우면 피드에 콜백을 지정하지 않아도되지만 스크립트에 넣고 검사관의 매개 변수를 채우십시오. feilds가 필요하거나 그렇지 않으면 피드도 오지 않을거야

#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 
+1

ok, 맞습니다 ...하지만 페이스 북 응용 프로그램을 제거한 후 시도한 후에 fb 벽에 성공적으로 게시됩니다. –

+0

idk 당신에게 무엇을 말할 것인가? – JRowan

+0

idk 의미 .. ??? idk에 대해 모르겠다. –