我如何编辑此代码以将目录中的照片发布到我的墙上: “C:\myfiles\myphoto.jpg”?
FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
Parameter.with("message", "Test cat"));
最佳答案
您只需将代码中的 cat.png
替换为您的绝对图像路径即可。如下所示:
InputStream is = new FileInputStream(new File("C:\\myfiles\\myphoto.jpg"));
FacebookType publishVideoResponse =facebookClient.publish("me/photos",FacebookType.class,
BinaryAttachment.with("myphoto.jpg", is),
Parameter.with("message", "MY PHOTO POST"));
关于facebook - 使用restFB 在 Facebook 上发布照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19660975/