我米試圖簡單的程序更新FB的地位,但它給我的錯誤, 這是我嘗試......更新Facebook狀態問題(JAVA)
public class SendtoFacebook {
public static void main(String a[]) throws FacebookException {
SendtoFacebook sfb = new SendtoFacebook();
sfb.send("From My App: Rohan's App");
}
public void send(String message) throws FacebookException {
String FB_APP_API_KEY = new String("461632878708096");
String FB_APP_SECRET = new String("5513aa2b99879879897ff0fa5a7a");
String FB_SESSION_KEY = "";
FacebookJsonRestClient facebook = new FacebookJsonRestClient(FB_APP_API_KEY, FB_APP_SECRET);
//FacebookJsonRestClient facebookClient2 = (FacebookJsonRestClient)facebook.getFacebookRestClient();
FacebookJsonRestClient facebookClient = (FacebookJsonRestClient) facebook;
facebookClient.stream_publish(message, null, null, null, null);
System.out.println("successfully updated");
}
}
和M越來越此錯誤_線程「main」com.google.code.facebookapi.FacebookException中的異常:需要參數uid或會話密鑰 at com.google.code.facebookapi.JsonHelper.parseCallResult(JsonHelper.java:59) at com.google .code.facebookapi.ExtensibleClient.extractString(ExtensibleClient.java:2296) 在com.google.code.facebookapi.ExtensibleClient.stream_publish(ExtensibleClient.java:2150) 在com.google.code.facebookapi.SpecificReturnTypeAdapter.stream_publish(SpecificReturnTypeAdapter.java:503) 在socialdemo.SendtoFacebook.send(SendtoFacebook。 java:31) at socialdemo.SendtoFacebook.main(SendtoFacebook.java:19)
有沒有關於這個的任何哥們? plz .. thanx。
從列表中選擇所需的認證?從哪個列表 我有Access令牌,那麼接下來呢? –
選擇「獲取訪問令牌」。這會給你一個彈出窗口,顯示你可以選擇的幾個用戶/朋友/擴展權限。勾選需要的選項並選擇底部的「獲取訪問令牌」。 API頁面會要求您獲得從您的Facebook帳戶獲取信息的權限。一旦授予它,您將在原始頁面的「訪問令牌:」中看到新的訪問令牌。 然後在程序中使用該標記(鍵)作爲變量'FB_APP_API_KEY'。 – Salil
它給了我錯誤_ 線程「主」_com.google.code.facebookapi.FacebookException異常:會話密鑰格式錯誤._ –