Post

Replies

Boosts

Views

Activity

MusicKit background threads warning
Hello, I am working a music app with the new MusicKit API and I am not sure how to fix my current warning. I have the following methods to get recently played songs and another used to insert a new song into the queue after the current song. Both methods work but I am receiving the purple warning: “Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.”     func getRecentlyPlayed(){         let request = MusicRecentlyPlayedRequest()         Task{             let response = try await request.response()             let musicPlayer = ApplicationMusicPlayer.shared             musicPlayer.queue = ApplicationMusicPlayer.Queue(for: response.items)             try await musicPlayer.prepareToPlay()         }     }     func insertNextInQueue(items: MusicItemCollection) {         Task{             let musicPlayer = ApplicationMusicPlayer.shared             try await musicPlayer.queue.insert(items, position: .afterCurrentEntry)         }     } I have tried everything to force the insert to happen on the main thread but am not able to get the warning to go away. Despite the warning, the insert method works and doesn’t seem to impact my application at all. I am not sure what else to do at this point. Any help or suggestions would be much appreciated. Thanks, Dan
2
0
953
Aug ’22
MusicKit background threads warning
Hello, I am working a music app with the new MusicKit API and I am not sure how to fix my current warning. I have the following methods to get recently played songs and another used to insert a new song into the queue after the current song. Both methods work but I am receiving the purple warning: “Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.”     func getRecentlyPlayed(){         let request = MusicRecentlyPlayedRequest()         Task{             let response = try await request.response()             let musicPlayer = ApplicationMusicPlayer.shared             musicPlayer.queue = ApplicationMusicPlayer.Queue(for: response.items)             try await musicPlayer.prepareToPlay()         }     }     func insertNextInQueue(items: MusicItemCollection) {         Task{             let musicPlayer = ApplicationMusicPlayer.shared             try await musicPlayer.queue.insert(items, position: .afterCurrentEntry)         }     } I have tried everything to force the insert to happen on the main thread but am not able to get the warning to go away. Despite the warning, the insert method works and doesn’t seem to impact my application at all. I am not sure what else to do at this point. Any help or suggestions would be much appreciated. Thanks, Dan
Replies
2
Boosts
0
Views
953
Activity
Aug ’22
MusicLibraryRequest Loved songs, playlists, albums and artists
Is there a way to use the MusicLibraryRequest to get the users loved songs, playlists, albums and artists? I don't see a way in documentation but maybe I am missing it. Thanks, Dan
Replies
0
Boosts
1
Views
650
Activity
Jul ’22
EventKit Tags
I dont see anything in the documentation about how to add Tags in EventKit. Is that available to us to use and I just missed it in the documentation?
Replies
2
Boosts
1
Views
1.2k
Activity
Oct ’21
Dolby Atmos and Lossless labels
Is there a way to show the these labels in our own applications? If so, is this something we can search on and filter on?
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’21