iOS 16 ,Xcode14,AVAudioSession,Failed to set category

 NSError *error = nil;

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&error];   Here is the error: [as_client]     AVAudioSession_iOS.mm:2370  Failed to set category, error: 'what' Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"

There is no additional information about this error. Any help would be greatly appreciated.

Same error facing.. Speech recognizing stopped on a real device but work on simulator iOS 16

  [session setActive:YES error:&error];

2022-09-22 19:48:40.612219+0800 Runner[948:25592] [as_client]   AVAudioSession_iOS.mm:2370 Failed to set category, error: -50

Almost the same error, while trying to set Audio Session to AVAudioSessionCategoryPlayback. I've never faced this issue before iOS 16, and it does not seem to happen all the time:

AVAudioSession_iOS.mm:2370 Failed to set category, error: '!int'

Not sure what changed in iOS 16 ... Any idea ?

I encountered similar problem where in I was not able to record voice in ios 16,I was getting the below error

Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"

I had changed the category from record to playAndRecord and add defaultToSpeaker in options.

Post this changes it was working as expected.

I had same issue. when I find someone resolve this in this link. In iOS 16+, before starting to record, you should change the category. At the same, after ending the record, you should resume the original category.

This fix my problem, hope it helps!

Facing same issue. Changing the category seems to work fine for iOS versions before 16. but it fails for iOS 16+. any updates for a solution?... Thanks!

iOS 16 ,Xcode14,AVAudioSession,Failed to set category
 
 
Q