I dont undertand this error because im use features with audio in the background. Here is the code that i use it:
and here:
ans here is the full error on AppStoreConnect:
Code Block private func playTrack(filePath: URL) { self.timer?.invalidate() do { let songData = try Data(contentsOf: filePath, options: NSData.ReadingOptions.mappedIfSafe) try AVAudioSession.sharedInstance().setActive(true) player = try AVAudioPlayer(data: songData, fileTypeHint: AVFileType.mp3.rawValue) player?.delegate = self player?.prepareToPlay() sliderPodcast.isEnabled = true buttonPlayMinimized.isEnabled = true changeState(.playing) setupNowPlaying() } catch { presenter?.alertDownloadPodcast() } }
and here:
Code Block private func setupNowPlaying() { guard let podcastContent = presenter?.getCurrentPodcastContent() else { return } var nowPlayingInfo = [String : Any]() nowPlayingInfo[MPMediaItemPropertyTitle] = podcastContent.title if let image = imageViewPodcast.image { nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { size in return image } } nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = player?.currentTime nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = player?.duration nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = player?.rate MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo } private func updateAudioControlCenterPlaying(isPause: Bool) { guard var nowPlayingInfo = MPNowPlayingInfoCenter.default().nowPlayingInfo else { return } nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = player?.currentTime nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = isPause ? 0 : 1 MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo }
ans here is the full error on AppStoreConnect:
So, what do i have to do?Guideline 2.5.4 - Performance - Software Requirements
.
Your app still declares support for audio in the UIBackgroundModes key in your Info.plist but did not include features that require persistent audio.
.
Next Steps
.
The audio key is intended for use by apps that provide audible content to the user while in the background, such as music player or streaming audio apps. Please revise your app to provide audible content to the user while the app is in the background or remove the "audio" setting from the UIBackgroundModes key.