In new OS 10
Apple I have added new permission for access music library
, my issue is that with Ti.Media.queryMusicLibrary
, when I call this method the app crashes, I've tried to search for condition to check if user already gives access or request access to Music library can't find them!
var musicList = Ti.Media.queryMusicLibrary({
mediaType : Ti.Media.MUSIC_MEDIA_TYPE_MUSIC
});
After upgrade to ios
10 and appcelerator
SDK to 5.5.0.GA, when you call the above method the app will crash!
Try by adding below key to your tiapp.xml ios tag:
NSAppleMusicUsageDescription
<ios>
<plist>
<dict>
<key>NSAppleMusicUsageDescription</key>
<string>Allow this app to access your music library.</string>
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<false/>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</plist>
</ios>
Also,
Wrap that Ti code in try-catch block for safer usage.
As per the current docs, there's a method to check for Audio Permissions, though I am not sure whether it will ask for Music Library permission and it will only work on Ti SDK 6.0.0 which is not available yet for general public.
For more see these links: