App crashes with AVAudioSession privateBeginInterruption
I’m testing my app on device (a soundboard) and it crashes with a
EXC_BAD_ACCESS, I have use Breakpoints and the error came from
The crash happens following this pattern:
- The app is launched, we see the main menu
- A main menu button is pressed and a soundboard view is loaded (push), some buttons are pressed here and sounds are played.
- Return to main menu (
- App enters background
- When app enters foreground and the menu button of the soundboard is pressed the app crashes.
I have no idea what is happening here, I have installed CrashLytics and it only said:
Maybe the audio session gets released from memory and the app tries to access to it and fail?
The audio session is initialised in
// Initialize audio session [[AVAudioSession sharedInstance] setDelegate: self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: nil]; UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
viewDidUnload I have
[[AVAudioSession sharedInstance] setDelegate: nil];
Solutions Collect From Internet About “App crashes with AVAudioSession privateBeginInterruption”
The crash happens because you had set the delegate of session to your controller in this line
[[AVAudioSession sharedInstance] setDelegate: self];
but didn’t implemented the required delegate method (interruption one)
either remove the delegate setting line or implement the delegate method to solve crash
- How to develop iPhone MDM Server?
- Send and Read the SMS content sent via native SMS app cordova
- Swift: Long Press Gesture Recognizer – Detect taps and Long Press
- UIGraphicsBeginImageContextWithOptions and Multithreading
- Using the Network Link Conditioner on iOS devices
- set background image for entire iPhone / iPad app
- How to draw a border around a paragraph in UILabel?
- Path extension and MIME type of file in swift
- Property declaration help
- IONotificationPortCreate function call generates compiler error
- Autolayout issue Xcode 8
- Cocoa OSX: How can I make an image draggable
- How to create UnsafeMutablePointer<CGPoint> Object in swift
- Will iOS region monitoring call didEnterRegion on my app if my app is in a terminated state?
- Drawing a polygon with one color for stroke, and a different one for fill?