I've got a problem with my app where I'm testing it on my own phone.
I'm using audio kit to generate tones as part of the app. Everything seems to work fine. Sounds start, Stop, etc. They play when the app is closed and when the phone is locked, so background is working.
However, I'm seeing an issue where, even when STOP is pressed and the application exited, if I get a notification such as a text message, the base tone for the app starts to play.
If I then open the app, check the Start/Stop button - it says start so that. hasnt' been activated. If I click Start, then a 2nd tone starts. This one stops with the Stop button. However the original tone that was set off by an incoming message carries on playing.
Until I go to the Open Apps View on the phone and slide the application upwards.
For the life of me, I can't figure out whats happening here.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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