我使用 Titanium Appcelerator开发 Android 应用程序。我试图通过Facebook提要对话框发布文本和图像 ..但加载我的本地图像URL时出错..
var fileimg = Titanium.Filesystem.getFile(backupDir.nativePath," myimg.jpg");
var fb_data1 = {
description : "Some good text",
picture : fileimg.nativePath,
link : "www.googlee.com",
};
facebook_qfav.dialog("feed", fb_data1, showRequestResult);
function showRequestResult(e){
var s = '';
if (e.success) {
s = "SUCCESS";
if (e.result) {
s += "; " + e.result;
}
if (e.data) {
s += "; " + e.data;
}
if (!e.result && !e.data) {
s = '"success",but no data from FB.I am guessing you cancelled the dialog.';
}
} else if (e.cancelled) {
s = "CANCELLED";
} else {
s = "FAILED ";
if (e.error) {
s += "; " + e.error;
alert("facebook Share " + s);
}
}
}
错误:"图片网址格式不正确"
文件路径如下: file:///storage/sdcard0/myimg.jpg
但是如果我将远程URL传递给picture属性,则图像会显示在对话框中...... 本地URL会发生什么..?
答案 0 :(得分:1)
我认为唯一的问题是nativepath
中有大写字母P.所以,它:nativePath
所以代替picture : fileimg.nativepath
,它应该是picture : fileimg.nativePath,
希望它有所帮助。