我需要发布位图到Facebook墙以及消息和url链接。facebook API添加照片
据https://developers.facebook.com/docs/reference/api/user/#photos,有4个参数的照片添加到Facebook的相册:
source
,message
,place
,no_story
。
不过,我建议使用这样的代码:
Bitmap bm = ...;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(CompressFormat.JPEG, 100, baos);
final byte[] data = baos.toByteArray();
Bundle postParams = new Bundle();
postParams.putByteArray("photo", data);
postParams.putString("message", "My message here");
postParams.putString("link", "http://www.google.com");
Request request = new Request(session, "me/photos", postParams, HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
...这代码工作正常,但它并没有显示链接(“http://www.google.com” ) 在墙壁上。
我有三个问题:
为什么
postParams.putByteArray("photo", data)
工作?根据文档,没有photo
参数(参见上文)。如果无法使用
link
参数,如何SLComposeViewController类(http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/SLComposeViewController_Class/Reference/Reference.html)工作?它有- (BOOL)addURL:(NSURL *)url
方法。如果可以使用
link
参数,为什么它不起作用?