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

iOS: Titanium.Media.openMusicLibrary returns empty items on iOS 9.3.5

    Details

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

      Ti 7.5.0.GA
      CLI 7.0.9
      XCode 10.1

    • Story Points:
      3
    • Sprint:
      2019 Sprint 5, 2019 Sprint 6, 2019 Sprint 7, 2019 Sprint 8, 2019 Sprint 9

      Description

      It works on iOS 10 or later, but fails on iOS 9.3.5

      To reproduce:

      • select a song
      • music library will return an item
      • stringify will print an empty item
      • trying to read the title property on the item crashes the app

      var win = Ti.UI.createWindow({
          backgroundColor: '#fff'
      });
       
      var btn = Ti.UI.createButton({
          title: 'Trigger'
      });
       
      btn.addEventListener('click', function() {
          if (Ti.Media.hasMusicLibraryPermissions()) {
              openMusicLibrary();
          } else {
              Ti.Media.requestMusicLibraryPermissions(function(e) {
                  if (!e.success) {
                      alert("No permissions!");
                      return;
                  }
                  openMusicLibrary();
              })
          }
      });
       
      win.add(btn);
      win.open();
       
      function openMusicLibrary() {
          Ti.Media.openMusicLibrary({
      		allowMultipleSelections : true,
      		success : function(event) {
      			// this will be printed
      		        Ti.API.info(JSON.stringify(event));
      			// this crashes the app even if items > 0
               		Ti.API.info('title = ' + event.items[0].title);	
      		},
      		cancel : function() {
      			alert("Aborting ");
      		},
      		error : function(error) {
      			// called when there's an error
      			var a = Titanium.UI.createAlertDialog({
      				title : 'Music Library'
      			});
      			if (error.code == Titanium.Media.NO_MUSIC_PLAYER) {
      				a.setMessage('Please run this test on device.');
      			} else {
      				a.setMessage('Unexpected error: ' + error.code);
      			}
      			a.show();
      		}
      	});
      }
      

        Attachments

          Activity

            People

            • Assignee:
              jvennemann Jan Vennemann
              Reporter:
              alarocca alessandro la rocca
              Reviewer:
              Vijay Singh
              Tester:
              Samir Mohammed
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-21037
                  Sync status:
                  PENDING
                  Last received:
                  Last sent:

                  Git Source Code