AVAudioSession Error: Deactivating Audio Session with I / O Triggering

2017-02-24 14:56:44.280 PropertyManager[10172:5336578] 14:56:44.280 ERROR:    [0x1a0a24000] AVAudioSession.mm:692: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.

2017-02-24 14:56:44.281 PropertyManager[10172:5336578] error === Error Domain=NSOSStatusErrorDomain Code=560030580 "(null)"
PropertyManager was compiled with optimization - stepping may behave oddly; variables may not be available.
+4
source share
1 answer

Your error log expresses itself very succinctly:

Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session

This tells you about the problem as well as the solution.

Now you are doing something like this:

[[AVAudioSession sharedInstance] setActive:NO
               withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
                                             error:nil];

However, you must first stop the instance of the audio player, and then set the activation status to Yes or No.

[yourAudioPlayer stop];
[[AVAudioSession sharedInstance] setActive:NO
                   withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
                                                 error:nil];

See your Apple documentation for the enum AudioSessionSetActiveOption enum values .

See also: Apple documentation on setActive: withOptions method

Regarding your second mistake

PropertyManager was compiled with optimization - stepping may behave oddly; variables may not be available.

see this great answer .

+4
source

Source: https://habr.com/ru/post/1670713/


All Articles