[Note: this issue was happening on a main testing device, and after testing the same code on other devices, this issue is only happening on 1 out of 4 devices]
We are successfully getting a MusicCatalogResourceResponse for every song ID where we make the MusicCatalogResourceRequest. We are able to display the song title, artist name, and album artwork for each Song in the response.
However - when we go to play the song, there are some songs that play, and several songs that do not play. For the songs that don't play, the console shows “Failed to prepareToPlay error=<MPMusicPlayerControllerErrorDomain.6 "Failed to prepare to play" {}>”
let musicPlayer = ApplicationMusicPlayer.shared
func playSong(_ song: Song) {
musicPlayer.queue = [song]
Task {
try await musicPlayer.prepareToPlay()
try await musicPlayer.play()
}
Is there anything else we can investigate about what may be causing specific song IDs not to play on this specific device?
Even if we remove line 6 musicPlayer.prepareToPlay() we still see the same console error when running playSong with the Songs that don't work.
It is always the same song IDs that we can play and always the same song IDs that we cannot get to play, even trying them across different projects with different bundle identifiers.
We can tap to play a song that works, and it starts playing immediately. Then tap a song that doesn't work, and nothing happens. Then back to a song that works. It's consistent which songs succeed and fail on this device.
Perhaps there is an issue specific to this very iPad when it comes to certain specific songs, but we'd like to be confident that an app relying on MusicKit will be able to play songs that have been successfully loaded with a MusicCatalogResourceResponse.
Thanks for any help or suggestions about what we may be able to investigate further on the device or what we should consider when launching an app that expects anyone with Apple Music to be able to listen to any of the songs loaded by the app.
Specific iPad details: iPad Pro (12.9-inch) (6th generation) running iPadOS 26.4 Beta
Two of the song IDs that won't play on this iPad (even though we can access and display their album artwork and all other information): 943204000 and 1441164805
Hello RanLearns,
Please create a bug report on Feedback Assistant to send us sysdiagnose logs. Once you open the bug report, please post the FB number here for my reference.
The sysdiagnose should be generated shortly after the build of your app has terminated, even if the logs can't be synced off the device until later.
Important: Note the date and time the issue occurred and include this information with your sysdiagnose. This information is vital in helping us pinpoint the issue being captured in the sysdiagnose log file.
For information on generating and retrieving a sysdiagnose click the link below and choose the appropriate platform from the search results:
https://developer.apple.com/bug-reporting/profiles-and-logs/?name=sysdiagnose
A sysdiagnose may be too large to send in e-mail. If you don't have the ability to send large files, let us know so that we can send you instructions for our Box account.
If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?
Let me know if you'd like to know more,
Richard Yeh Developer Technical Support