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