-->

iOS 9.3.2 Breaks MPMusicPlayerController

2020-05-24 06:39发布

问题:

I'm trying to integrate Apple Music to my app, I managed to get it working flawlessly until this morning.

After updating to iOS 9.3.2 nothing is the same:

The permission system works the same (SKCloudServiceController) to retrieve the AuthorizationStatus and Capability of the user.

However, the MPMusicPlayerController do not behave the same using the new iOS version, let me explain :

  • On iOS 9.3.1, if I call the playerController.play() method after setting my tracks in playerController.setQueueWithStoreIDs(:_), I immediately receive the MPMusicPlayerControllerNowPlayingItemDidChangeNotification with the playerController.indexOfNowPlayingItem equal to 0 and the music is playing normaly.

  • On iOS 9.3.2, if I call the playerController.play() method after setting my tracks in playerController.setQueueWithStoreIDs(:_), I immediately receive the MPMusicPlayerControllerNowPlayingItemDidChangeNotification with the playerController.indexOfNowPlayingItem equal to NSNotFound and the music not playing.

I checked this behavior on iPhone 6, 6s, 6s+, and 5S. On iOS 9.3.1 everything works and the behavior is extremely unlikely to succeed in 9.3.2 (it works like 1% of the time).

I also looked up some app already offering the Apple Music integration on the Store, the result is the same, the apps are not working properly on iOS 9.3.2. That's why I filled a bug report to Apple.

If anybody has a solution to this problem, I'd love to hear it !

!!! Update !!! :

I just noticed that MPMusicPlayerController.setQueueWithStoreIDs(_:) just disappeared from the documentation this morning :O, it was there since March 21 2016 !

It's still THERE