使用Graph API将多张照片上传到Facebook

时间:2012-02-17 13:14:03

标签: facebook facebook-graph-api titanium titanium-mobile

在我的Titanium移动应用程序中我试图将多个图像发布到Facebook相册。但对我来说,单个图像上传工作正常,但多个图像没有。这是我的示例代码。 提前致谢。我的Titanium SDK 1.7.5和我的平台ios

var media = [];
var file1 = Titanium.Filesystem.getFile(currIamge1);
var blob1 = file1.read();
var file2 = Titanium.Filesystem.getFile(currIamge2);
var blob2 = file2.read();
    media.push({'message': 'House1', 'picture': blob1}); 
    media.push({'message': 'House2', 'picture': blob2}); 
var path = album_id+'/photos'; 
Titanium.Facebook.requestWithGraphPath(path, media, 'POST', function(e){
    if (e.success) {
        alert("Success!  From FB: " + e.result);
    } else {
        if (e.error) {
            alert(e.error);
        } else {
            alert("Unkown result");
        }
    }
});

0 个答案:

没有答案