Post

Replies

Boosts

Views

Activity

MusicKit Get song from SystemMusicPlayer.Queue often Error
I want get song object from SystemMusicPlayer.Queue use musickit . But there's often crash . Here is my code   func getSongData(complection:@escaping (Song)->())   {     Task.detached {              do {             let queue : SystemMusicPlayer.Queue?                   queue = SystemMusicPlayer.shared.queue                   if queue?.currentEntry != nil         {           let request = MusicCatalogResourceRequest<Song>(matching: \.id, equalTo: MusicItemID(rawValue: queue?.currentEntry?.item?.id.rawValue ?? "1595045323"))           let response = try? await request.response()                    complection((response?.items.first)!)         }     }      }      }
1
0
929
May ’22