Titanium Mobile - PhotoGallery - Success callback - event property - media.file returns null

允我心安 提交于 2019-12-25 07:58:40

问题


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

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]
});

回答1:


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 ...:)



来源:https://stackoverflow.com/questions/13488176/titanium-mobile-photogallery-success-callback-event-property-media-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!