[TIMOB-26829] iOS: Titanium.Media.openMusicLibrary returns empty items on iOS 9.3.5
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-04-25T12:00:09.000+0000 |
Affected Version/s | Release 7.5.0 |
Fix Version/s | Release 8.1.0 |
Components | n/a |
Labels | n/a |
Reporter | alessandro la rocca |
Assignee | Jan Vennemann |
Created | 2019-02-07T10:29:44.000+0000 |
Updated | 2019-04-25T12:00:09.000+0000 |
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
File | Date | Size |
---|---|---|
log.txt | 2019-02-15T07:46:30.000+0000 | 8354 |
log.txt | 2019-02-07T11:13:29.000+0000 | 101028 |
New Test 18-2-19 10-19 PM.crash | 2019-02-18T16:28:01.000+0000 | 44511 |
Hello, Thanks for reporting this. Would you mind providing more information for the issues you are experiencing? It would be great if you can share the complete error logs using the following command: *appc run -p ios -T simulator -l trace*
This is the log directly from my app, not the sample I copied before. Anyway the specific code to get items by music gallery is the same. [^log.txt] When I try to read the "title" property of the first item selected, the app crashes.
Hello [~alarocca], I have tested this issue on my end and cannot reproduce the same crash on 7.5.0.GA. Please try the below code on your end and let us know. *Test Code:* app.js
tiapp.xml file
Thanks
Thanks Fazlul, unfortunately even your code crashes on iOS 9.3.5 while it works on later iOS versions. Did you try it on a device running iOS 9.3.5? I just added a log on success to print the event. After this, the app crashes and does not print anything else. INFO] : Finished building the application in 10s 626ms [INFO] : Installing app on device: iPad [INFO] : App successfully installed on device: iPad Please manually launch the application -- Start application log ----------------------------------------------------- [INFO] : Test 1.0 (Powered by Titanium 7.5.0.2e5a7423d0) [INFO] : {"type":"success","representative":{},"types":1,"code":0,"success":true,"items":[{}],"source":{}} -- End application log -------------------------------------------------------
[^log.txt]
Hi [~alarocca], Thanks for your feedback. Do you get this crash only iOS version iOS 9.3.5?. If you have any others device can you also check on that device and let us know? Actually, I have tested it upper iOS version
Yes, only iOS 9.3.5 does not work. Upper iOS versions works properly.
Thanks for the information. Yes, it's not working on iOS 9.3.5. I am going to assign it to our R&D team and they will take an action soon. Thanks
PR: https://github.com/appcelerator/titanium_mobile/pull/10729
FR Passed, waiting on Jenkins build.
*Closing ticket*, changes present in SDK Version
8.1.0.v20190423134840
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10729