2012-04-29 3 views
0

안녕하세요, 저는 페이스 북 개발을 처음 사용하고 있으며 아래 코드를 사용하여 피드를 게시하려고하지만 메시지 또는 user_message_prompt가 텍스트 상자. 이를 허용하려면 신청서에 뭔가를 설정해야합니까? 내가받는 것은 기본 메시지입니다.Fb.ui 피드 메서드를 사용하여 기본 메시지를 사용하여 메시지 또는 user_prompt_message를 전혀 표시하지 않음

아래의 두 가지 방법을 시도했지만 두 가지 모두 메시지 또는 user_message_prompt 메시지를 표시하지 않습니다.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head> 
    <title></title> 
</head> 
<body> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script> 

     FB.init({ appId: "174009502722096", status: true, cookie: true, xfbml: true }); 

     function postToFeed() { 

     var publish = { 
     method: 'feed', 
     message: 'Martin Okello presents share', 
     caption: 'Visit MartinLayooinc', 
     description: (
     'Martin Okello, aka the medallion presents his application' 
     ), 
     link: 'http://www.martinlayooinc.co.uk', 
     picture: 'http://www.martinlayooinc.co.uk/topImages/bigMedallion.jpg', 
     user_message_prompt: 'Share MartinLayooinc Software with friends!' 
     }; 

     FB.ui(publish, 
     function(response) 
     { 
     alert('MartinLayooInc has been posted!!') 
     }); 

     function callback(response) { 
     document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
     } 

     FB.ui(obj, callback); 

     } 

</script> 
    <!--from here--> 
    <div id="fb-root"> 
     <p> 
      <a onclick='postToFeed(); return false;'><img src="topImages/facebook_button.png" style="height:20px; width:80px;" /> 
      </a> 
     </p> 
     <p id='msg'> 
     </p> 
    </div> 
</body> 
</html> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({ appId: '174009502722096', status: true, cookie: true, xfbml: true }); 

     /* All the events registered */ 
     FB.Event.subscribe('auth.login', function (response) { 
      // do something with response 
      login(); 
     }); 
     FB.Event.subscribe('auth.logout', function (response) { 
      // do something with response 
      logout(); 
     }); 

     FB.getLoginStatus(function (response) { 
      if (response.session) { 
       // logged in and connected user, someone you know 
       login(); 
      } 
     }); 
    }; 
    (function() { 
     var e = document.createElement('script'); 
     e.type = 'text/javascript'; 
     e.src = document.location.protocol + 
      '//connect.facebook.net/en_US/all.js'; 
     e.async = true; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 

답변

4

나는 둘 다 더 이상 사용되지 않습니다. 이제 메시지 매개 변수가 무시되고 설명서의 다른 매개 변수가 표시되지 않았습니다. 분명히 페이스 북은 사용자가 강제로 또는 메시지를 표시하지 않고 텍스트 필드에 자신의 메시지를 넣길 원합니다.

https://developers.facebook.com/docs/reference/javascript/FB.ui/

을 여기에 상세 페이지 : 여기에 대한 주요 정보 페이지를 확인 바닥에

https://developers.facebook.com/docs/reference/dialogs/feed/

스크롤하면 지원되는 매개 변수를 볼 수 있습니다. 바라건대 그것은 당신을위한 게임 체인저가 아닙니다.

-1

당신은 그런 다음 아래처럼 함수를 호출이

window.fbAsyncInit = function() {FB.init({ 
appId: '{YOUR APP ID}', 
xfbml: true, 
version: 'v2.1' 
}); 
}; 
(function(d, s, id) { 
var js, fjs = d.getElementsByTagName(s)[0]; 
if (d.getElementById(id)) { 
return; 
} 
js = d.createElement(s); 
js.id = id; 
js.src = "//connect.facebook.net/en_US/sdk.js"; 
fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk')); 

function share_prompt() { 
FB.ui({ 
method: 'feed', 
name: 'Your App Name', 
link: 'https://example.com', 
picture: 'http://example.com/img/fbicon.jpg', 
caption: 'Your Caption here', 
description: 'some sort of your own description', 
message: 'Your Message goes here mate' 
}); 
} 

같은 것을해야한다;

<div><a href="#" onclick="share_prompt()">Click to open your dialog</a>  </div> 
관련 문제