Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20072

iOS: Ti.Media.saveToPhotoGallery does not call back for unsupported mime types

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 5.1.1
    • Fix Version/s: Release 5.2.0
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      SDK 5.1.1.GA
      iOS 9.1 Simulator

    • Story Points:
      3
    • Sprint:
      2015 Sprint 25 SDK

      Description

      If you pass a File or Blob of unsupported extension/mimeType to Ti.Media.saveToPhotoGallery() neither of the two callbacks is called and no error is logged.

      This is because the code 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.

      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();
      

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              fokkezb Fokke Zandbergen
              Reviewer:
              Chee Kiat Ng (Inactive)
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code