Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not authorized, skipping filter predicate application

Upon launch on an iOS10 device, I get the following output:

[MC] Reading from public effective user settings.

[SDKPlayback] MPMusicPlayerController] MPMusicPlayerController: Server is not running, deferring check-in

[SDKLibrary] Not authorized, skipping filter predicate application

The app plays music from the user's library and therefore must ask permission, so I have updated info.plist with the required key strings for NSAppleMusicUsageDescription but the app crashes as soon as the predicate is called. When the app is stopped and the launch screen disappears, the permission window is finally displayed. If I tap allow, subsequent launches will work just fine.

My question is: Does the "server not running" error have anything to do with the permissions window not being shown? If so, how do I start it?

like image 383
rocketman240 Avatar asked Nov 20 '16 21:11

rocketman240


1 Answers

So, the way an MPMusicPlayerController works is:

  1. You have to have the key in the Info.plist, as you already know.

  2. In your code, check authorization with MPMediaLibrary.authorizationStatus.

  3. If you don't have authorization, you request authorization using MPMediaLibrary.requestAuthorization. You cannot proceed until you have authorization. Be careful because the call is asynchronous and the completion is called on a background thread.

  4. Now you make an MPMediaItemCollection and call setQueue(with:) and then play.

like image 86
matt Avatar answered Oct 11 '22 15:10

matt