android - 钛安卓 : Facebook dialog image URL not properly formatted

标签 android facebook titanium

我使用 Titanium Appcelerator 开发了一个 Android 应用程序。我曾尝试通过 Facebook 提要对话框发布文本和图像 .. 但是加载我的本 map 片 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);
        }
    }
}

错误:“图像 URL 格式不正确”

文件路径如下: file:///storage/sdcard0/myimg.jpg

但是如果我将远程 URL 传递给图片属性,图像就会显示在对话框中... 本地 URL 会怎样?

最佳答案

我认为唯一的问题是 nativepath 中有大写字母 P。所以,它的:nativePath

所以 picture : fileimg.nativepath 应该是 picture : fileimg.nativePath,

Documentation .

希望对您有所帮助。

关于android - 钛安卓 : Facebook dialog image URL not properly formatted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25863304/

相关文章:

android - 让 edittext 在所有版本的 Android 中看起来像全息灯

java - 如何从 Cloud Firestore 获取一组数据?

javascript - Appcelerator/Titanium Alloy - 如何在将字符串添加到 View 之前对其进行操作

javascript - 在 Titanium mobile 中删除 TableViewRow

javascript - 函数遍历循环并工作一次但再也不会

java - 解析具有不同数量条目的嵌套 JSON

android - 运行失败并显示 INSTALL_FAILED_TEST_ONLY

c# - Facebook C# SDK 获取当前用户

ios - 为什么 FBSDK 共享对话框不适用于图像附件?

ios - 不推荐使用解析和方法来实现 Facebook