2011-09-02 38 views

回答

0

只需使用RestFB即可。下面的例子是從真正優秀的文檔所採取的網站上:

// Publishing an image to a photo album is easy! 
// Just specify the image you'd like to upload and RestFB will handle it from there. 
FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN); 
FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class, 
    BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")), 
    Parameter.with("message", "Test cat")); 

out.println("Published photo ID: " + publishPhotoResponse.getId()); 
+0

它不工作:( –

+0

必須在您的訪問令牌有一個錯誤,或者你沒有正確傳遞文件內容:我使用相同的代碼將數據從S3發佈到Facebook相冊中。 – Femi