[AC-2574] iOS7: openPhotoGallery returns empty media on success event
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2014-04-23T05:02:11.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Alloy, Titanium SDK & CLI |
| Labels | media |
| Reporter | Marc Andrew Landles |
| Assignee | Ritu Agrawal |
| Created | 2014-02-18T18:54:52.000+0000 |
| Updated | 2016-03-08T07:41:38.000+0000 |
Description
Testing code:
Ti.Media.onpenPhotoGallery({
success: function(event) {
Ti.API.debug(JSON.stringify(event));
}
});
Result JSON:
bq. {"code":0,"type":"success","source":{},"mediaType":"public.image","success":true,"media":{}}
Works well on Android 4.4
The event.media seems empty on a JSON.stringify(event.media). I found that iOS needs to write the BLOB object to a file before and after you can handle it like a file object. Working code:
JSON.stringify() still shows the file has empty though ...Ti.Media.onpenPhotoGallery({ success: function(event) { var tempFile = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, 'picture.jpg'); tempFile.write(event.media); // Add the use of the image file } });I am having problem running this code on both iOS and Android platforms. I will try on another device now.
The Blob is being created with actual image Data. iOS does not send out any media url info. Hence blob has no properties.