{ "id": "153473", "key": "TIMOB-20072", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-30T02:30:24.000+0000", "created": "2015-11-28T06:45:46.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "17532", "name": "Release 5.1.1", "archived": false, "released": true, "releaseDate": "2015-11-24" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-01-15T16:34:34.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "If you pass a File or Blob of unsupported extension/mimeType to {{Ti.Media.saveToPhotoGallery()}} neither of the [two callbacks|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-saveToPhotoGallery] is called and no error is logged.\r\n\r\nThis is because [the code|https://github.com/appcelerator/titanium_mobile/blob/55f45d09fd30d63e7218954658a35e86335bf29d/iphone/Classes/MediaModule.m#L776-L838] only calls the error callback when it is passed no File or Blob and not when the File or Blob is of unsupported extension/format.\r\n\r\n*Steps*\r\n\r\n1. Create a default project (that has {{KS_nav_ui.png}} in {{Resources}}).\r\n2. Run with the sample code and confirm it works.\r\n3. Switch the two {{var file}} lines.\r\n4. Run again and confirm neither {{success}} nor {{error}} is called back and no error is showing in logs either.\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({ \r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n\ttitle: 'Click Me'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n\tvar file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'KS_nav_ui.png');\r\n\t// var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js');\r\n\r\n\tif (!file.exists()) {\r\n\t\talert('File does not exist');\r\n\t\treturn;\r\n\t}\r\n\r\n\tTi.Media.saveToPhotoGallery(file.read(), {\r\n\t\tsuccess: function(e) {\r\n\t\t\talert('Success: ' + JSON.stringify(e));\r\n\t\t},\r\n\t\terror: function(e) {\r\n\t\t\talert('Error: ' + JSON.stringify(e));\r\n\t\t}\r\n\t});\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Ti.Media.saveToPhotoGallery does not call back for unsupported mime types", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "SDK 5.1.1.GA\r\niOS 9.1 Simulator", "closedSprints": [ { "id": 536, "state": "closed", "name": "2015 Sprint 25 SDK", "startDate": "2015-12-05T01:30:40.415Z", "endDate": "2015-12-19T01:30:00.000Z", "completeDate": "2015-12-29T03:19:42.127Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "371616", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Added the else-case of the mime check, corrected the miss-spelling in the error messages.\r\n\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/7510\r\nDemo: See demo code above\r\nScreen: http://abload.de/img/simulatorscreenshot29ujsza.png", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-30T01:53:22.000+0000", "updated": "2015-11-30T02:17:22.000+0000" }, { "id": "371619", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR and FT passed. PR Merged.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-30T02:30:04.000+0000", "updated": "2015-11-30T02:30:04.000+0000" }, { "id": "371637", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks for the quick fix [~hansknoechel]. I noticed one more _invalid mimeType else_ missing after [line 849|https://github.com/hansemannn/titanium_mobile/blob/3258a9c9634420c3ff3f0ba32d2c8885cc44fa10/iphone/Classes/MediaModule.m#L846-L849].", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-30T07:50:04.000+0000", "updated": "2015-11-30T07:50:04.000+0000" }, { "id": "374682", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.2 (15C50)\r\nStudio 4.4.0.201511241829\r\nTi SDK 5.2.0.v20160114021251\r\nAppc NPM 4.2.2\r\nAppc CLI 5.2.0-224\r\nXcode 7.2 (7C68)\r\nNode v0.12.7\r\nJava 1.7.0_80\r\n\r\nError messages now appear for unsupported mime types in saveToPhotoGallery(). Used a modified version of the supplied test case to include more blobs and file types/extensions.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-01-15T16:34:34.000+0000", "updated": "2016-01-15T16:34:34.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }