{ "id": "165201", "key": "TIMOB-24281", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2017-01-20T22:40:09.000+0000", "created": "2017-01-06T00:52:25.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" }, { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-01-20T22:40:17.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h6.Reproduce\r\n1. Create a new projects\r\n2. Add iOS 10 permissions onto your plist on tiapp.xml.\r\n3. Execute this function below: \r\n{code}\r\n\t\tTitanium.Media.openMusicLibrary({\r\n\t\t\tallowMultipleSelections : false,\r\n\t\t\tmediaTypes : Titanium.Media.MUSIC_MEDIA_TYPE_MUSIC|Titanium.Media.MUSIC_MEDIA_TYPE_ANY_AUDIO,\r\n\t\t\tsuccess : function(event) {\r\n\t\t\t\t// called when media returned from the MusicLibrary\r\n\t\t\t\tconsole.log(\"Results: \" + JSON.stringify(event));\r\n\t\t\t},\r\n\t\t\tcancel : function() {\r\n\t\t\t\talert(\"Aborting \");\r\n\t\t\t},\r\n\t\t\terror : function(error) {\r\n\t\t\t\t// called when there's an error\r\n\t\t\t\tvar a = Titanium.UI.createAlertDialog({\r\n\t\t\t\t\ttitle : 'Music Library'\r\n\t\t\t\t});\r\n\t\t\t\tif (error.code == Titanium.Media.NO_MUSIC_PLAYER) {\r\n\t\t\t\t\ta.setMessage('Please run this test on device.');\r\n\t\t\t\t} else {\r\n\t\t\t\t\ta.setMessage('Unexpected error: ' + error.code);\r\n\t\t\t\t}\r\n\t\t\t\ta.show();\r\n\t\t\t}\r\n\t\t});\r\n{code}\r\n4. Log the MusicLibraryResponseType on success\r\n5. Launch the app on device only!\r\n\r\nh6.Expected Result\r\nThe 'items' attribute will be populated with data. \r\n\r\nh6.Actual Result\r\nThe 'items' attribute will be an empty dictionary.\r\nLike: \r\n{code}\r\n{\"items\":[{}],\"source\":{},\"types\":1,\"code\":0,\"success\":true,\"type\":\"success\",\"representative\":{}}\r\n{code}", "attachment": [ { "id": "61184", "filename": "tiapp (1).xml", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2017-01-06T00:52:24.000+0000", "size": 8288, "mimeType": "text/xml" } ], "flagged": false, "summary": "iOS: Titanium.Media.openMusicLibrary returns empty items on iOS 10 and 9", "creator": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "subtasks": [], "reporter": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "environment": "Ti SDK: 6.0.1GA\r\nXcode 8.2\r\nCLI 6.1.0", "comment": { "comments": [ { "id": "404203", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "So it works on master (6.1.0) for me, need to perform 6.0.1.GA device tests. But {{event.items.length}} returns 1 for me, the items are just not stringified in the console. I'll get back soon. \r\n\r\n*EDIT*: Tested with 6.0.1.GA as well, using all kind of configurations (including the one linked here in the tiapp.xml). The items are returned, you can check it by grabbing the title:\r\n{code:js}\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n if (Ti.Media.hasMusicLibraryPermissions()) {\r\n openMusicLibrary();\r\n } else {\r\n Ti.Media.requestMusicLibraryPermissions(function(e) {\r\n if (!e.success) {\r\n alert(\"No permissions!\");\r\n return;\r\n }\r\n openMusicLibrary();\r\n })\r\n }\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n\r\nfunction openMusicLibrary() {\r\n Ti.Media.openMusicLibrary({\r\n\t\tallowMultipleSelections : true,\r\n\t\tmediaTypes : Titanium.Media.MUSIC_MEDIA_TYPE_MUSIC | Titanium.Media.MUSIC_MEDIA_TYPE_ANY_AUDIO,\r\n\t\tsuccess : function(event) {\r\n\t\t\t// called when media returned from the MusicLibrary\r\n console.log(event.items[0]);\r\n console.log(event.items[0].title);\r\n\t\t},\r\n\t\tcancel : function() {\r\n\t\t\talert(\"Aborting \");\r\n\t\t},\r\n\t\terror : function(error) {\r\n\t\t\t// called when there's an error\r\n\t\t\tvar a = Titanium.UI.createAlertDialog({\r\n\t\t\t\ttitle : 'Music Library'\r\n\t\t\t});\r\n\t\t\tif (error.code == Titanium.Media.NO_MUSIC_PLAYER) {\r\n\t\t\t\ta.setMessage('Please run this test on device.');\r\n\t\t\t} else {\r\n\t\t\t\ta.setMessage('Unexpected error: ' + error.code);\r\n\t\t\t}\r\n\t\t\ta.show();\r\n\t\t}\r\n\t});\r\n}\r\n{code}\r\nIt was just the log that didn't log all the properties of the media item, which is expected because it is an array of objects. So either iterate over the object keys or just check the [Ti.Media.openMusicLibrary|docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-openMusicLibrary] docs. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-06T08:44:58.000+0000", "updated": "2017-01-18T17:39:53.000+0000" }, { "id": "404991", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with:\r\nNPM Version: 2.15.9\r\nNode Version: 4.5.0\r\nMac OS: 10.12.1\r\nAppc CLI: 6.1.0\r\nAppc CLI NPM: 4.2.8\r\nTitanium SDK version: 6.1.0.v20170120115404\r\nAppcelerator Studio, build: 4.8.1.201612050850\r\nXcode 8.2\r\niOS Device: 10\r\n\r\nI tested this on an iOS 10 Device, and found that when I selected a song, the object type and the title are printed in the console. I tried this on 2 different songs and saw this in the console:\r\n{code}\r\n[INFO] : [object TiMediaItem]\r\n[INFO] : Holocene\r\n[INFO] : [object TiMediaItem]\r\n[INFO] : The Miracle (Of Joey Ramone)\r\n{code}\r\n\r\nThe output shows that demo code works as expected.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-20T22:35:34.000+0000", "updated": "2017-01-20T22:35:34.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }