I'm using AVAudioSession in an app that only performs audio playback. I'm setting my audioSession's mode and category in applicationDidFinishLaunchingWithOptions:
.
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setMode(AVAudioSessionModeDefault)
try audioSession.setCategory(AVAudioSessionCategoryPlayback)
}
catch {}
I never set a different mode or category during my app's lifetime, and I activate my audio session when the user taps a play button. In what scenario would either of these methods (setMode:error:
and setCategory:error
) throw an error? What should I expect to handle in my catch block?