Post

Replies

Boosts

Views

Activity

Reply to Xcode 14.3.1+ Bug: App crashes on launch iOS 16.0 - MediaPlayer
@MobileTen what do you mean by "Is the value media or Media?" I created a class called MediaManager. There is no build errors or anything. There is no issue on Xcode 14.2 but for some reason on Xcode 14.3.1 or later, Apple's MediaPlayer framework could not find MPMusicPlayerPlayParameters and results crash while launching the app. I guess MediaPlayer framework is a dynamic framework and that is the reason why it fails on Run Time. Following iOS versions are affected; 16.0, 16.1 and 16.2. (I couldn't test on iOS 16.3 or iOS 15) However it doesn't crash on iOS 16.4 or later. I checked the link and here is how I get the dictionary: import MusicKit import MediaPlayer /// ... var tracksInQueue: MPMusicPlayerPlayParametersQueueDescriptor = .init(playParametersQueue: []) /// ... func getPlayParameters(from playParameters: PlayParameters?) -> MPMusicPlayerPlayParameters? { guard let playParameters = playParameters, let data = try? JSONEncoder().encode(playParameters), let playParameters = try? JSONDecoder().decode(MPMusicPlayerPlayParameters.self, from: data) else { return nil } return playParameters } func prepareQueue() { DispatchQueue.global(qos: .utility).async { [weak self] in guard let self else { return } self.tracksInQueue = MPMusicPlayerPlayParametersQueueDescriptor(playParametersQueue: self.tracks.compactMap { self.mediaManager.getPlayParameters(from: $0.playParameters) }) self.tracksInQueue.startItemPlayParameters = self.tracksInQueue.playParametersQueue.first // queue is ready will be played when user presses the play button } /// ... }
Jul ’23