Titanium Mobile - PhotoGallery - 成功回调 - 事件属性 - media.file 返回 null [英] Titanium Mobile - PhotoGallery - Success callback - event property - media.file returns null

查看:20
本文介绍了Titanium Mobile - PhotoGallery - 成功回调 - 事件属性 - media.file 返回 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Titanium SDK:2.1.1,主机操作系统:Mac OS X 10.6.8,移动平台:iOS 5

Titanium SDK: 2.1.1, Host OS: Mac OS X 10.6.8, Mobile platform: iOS 5

我无法访问由 Titanium.Media.openPhotoGallery 的成功回调返回的Blob"对象的某些属性.不可访问的属性是file"和nativePath",但是我可以访问height"、width"和mimeType"等属性.我正在模拟器上测试.

I am un-able to access some properties of 'Blob' object returned by Titanium.Media.openPhotoGallery's success callback. The properties un-accessible are 'file' and 'nativePath', however I can access properties like 'height', 'width' and 'mimeType'. I'm testing on simulator.

这是我目前编写的代码.

Here is what I coded so far.

Titanium.Media.openPhotoGallery({
    success : function(event) {

        var image = event.media;

        if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {

            // following properties are accessible
            Ti.API.info(' event.media = ' + event.media );
            Ti.API.info('event.media.height = ' + event.media.height );
            Ti.API.info('event.media.width = ' + event.media.width );
            Ti.API.info('event.mediaType = ' + event.mediaType );

            // following properties are un-accessible
            Ti.API.info(' event.media.nativePath = ' + event.media.nativePath );
            Ti.API.info(' event.media.file = '  + event.media.getFile() );              
    },
    cancel : function() {},
    error : function(error) {},
    allowEditing : true,
    mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
});

推荐答案

您无法从 iphone 照片库访问文件或文件本机路径.它无法访问.尽管您可以将所选图像存储在文件系统或 sqlite 数据库上,然后在其上执行所有任务...:)

You cannot access file or file native path from iphone photo gallery. its not accessible. although you can store the selected image on file system or sqlite db and then perform all your tasks on it ...:)

这篇关于Titanium Mobile - PhotoGallery - 成功回调 - 事件属性 - media.file 返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆