Project: titanium
Issue TIMOB-20072: iOS: Ti.Media.saveToPhotoGallery does not call back for unsupported mime types
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. This 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. *Steps* 1. Create a default project (that has {{KS_nav_ui.png}} in {{Resources}}). 2. Run with the sample code and confirm it works. 3. Switch the two {{var file}} lines. 4. Run again and confirm neither {{success}} nor {{error}} is called back and no error is showing in logs either. {code:javascript} var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var btn = Ti.UI.createButton({	title: 'Click Me' }); btn.addEventListener('click', function() {	var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'KS_nav_ui.png');	// var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'app.js');	if (!file.exists()) {	alert('File does not exist');	return;	}	Ti.Media.saveToPhotoGallery(file.read(), {	success: function(e) {	alert('Success: ' + JSON.stringify(e));	},	error: function(e) {	alert('Error: ' + JSON.stringify(e));	}	}); }); win.add(btn); win.open(); {code}
Story points: 3