iosswiftmpmusicplayercontroller

MPMusicPlayerController.systemMusicPlayer locks main thread with _establishConnectionIfNeeded on iOS 14.5


An app that should play music now locks the main thread with following errors:

[SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong]
[SDKPlayback] SYNC-WATCHDOG-1: Attempting to wake up the remote process
[SDKPlayback] SYNC-WATCHDOG-2: Tearing down connection

Main thread is used as requested in MPMusicPlayerController documentation.

This happens with the .play() instruction:

private var musicPlayer = MPMusicPlayerController.systemMusicPlayer
// ....

musicPlayer.setQueue(with: selectedMediaItemCollection)
musicPlayer.shuffleMode = .songs
musicPlayer.repeatMode = .all
musicPlayer.play()

When the App starts, those errors are also visible even though I only request local music access:

[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
[Default] ACAccountStore 0x280fe13b0 - Error retrieving iTunesStore accounts. err=Error Domain=com.apple.accounts Code=9 "(null)"
[Default] ACAccountStore 0x280fe13b0 - Error retrieving iTunesStore accounts. err=Error Domain=com.apple.accounts Code=9 "(null)"

But there is also this that may be more damaging:

[Default] ACAccountStore 0x280fe13b0 - Error retrieving local store account. err=Error Domain=com.apple.accounts Code=9 "(null)"
[Default] [ICUserIdentityStore] Failed to fetch local store account with error: Error Domain=com.apple.accounts Code=9 "(null)"

This code was working prior to iOS 14.5.

Any idea for a fix or workaround?


Solution

  • Upgrading to iOS 14.5.1 fixed it.

    But the problem just reappeared with iOS 14.8... I filed a TSI with Apple.