I'm getting this error when I launch my application on the iPhone 14 Pro via Xcode. Everything builds OK. I"m using the audio kit plugin and Sound Pipe Audiokit.
The error starts as soon as I start the app and will carry on repeatedly.
I have background processing turned on as I'd like the sounds to play when the phone is locked via the headphones.
I can't find anything online about this error. None of my catches are printing anything in the logs either. So I don't know if this is just something that pops up repeatedly or whether there is something fundamentally wrong.
private func setupAudioSession() {
do {
let session = AVAudioSession.sharedInstance()
try session.setCategory(.playback, mode: .default, options: [.mixWithOthers])
try session.setActive(true, options: .notifyOthersOnDeactivation)
} catch {
errorMessage = "Failed to set up audio session: (error.localizedDescription)"
print(errorMessage ?? "")
}
}
// MARK: - Background Task Handling
private func setupBackgroundTaskHandling() {
// Handle app entering background
notificationObservers.append(
NotificationCenter.default.addObserver(
forName: UIApplication.didEnterBackgroundNotification,
object: nil,
queue: .main,
using: { [weak self] _ in
// Safely unwrap self
guard let self = self else { return }
self.handleBackgroundTransition()
}
)
)
I'm not sure if this is the code causing the issue. Any help would be gratefully appreciated. This is my first app I'm working on .
Topic:
Media Technologies
SubTopic:
Audio