ios16 AvAudioSession crash

I'v got a crash in ios16, and it worked well in other versions. Here is the code I called: *NSError error = nil; ret = [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&error];

Exception Info: **Exception Type: SIGABRT Exception Codes: #0 at 0x1d0524280 Triggered by Thread: 0

Application Specific Information: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects that adopt NSSecureCoding (object is of class 'NSNull').'

Last Exception Backtrace: 0 CoreFoundation 0x00000001914400c8 + 164 1 libobjc.A.dylib 0x0000000191063098 objc_exception_throw + 60 2 Foundation 0x000000019201e7d0 + 308 3 Foundation 0x0000000191fbd184 + 40 4 Foundation 0x0000000192019474 + 184 5 Foundation 0x00000001920248f8 + 568 6 Foundation 0x000000019200901c + 488 7 Foundation 0x0000000191fdaad4 + 252 8 Foundation 0x0000000192007730 + 232 9 Foundation 0x0000000191fdd030 + 1220 10 CoreFoundation 0x00000001913d6dd0 + 1016 11 CoreFoundation 0x00000001913d61a0 _CF_forwarding_prep_0 + 96 12 AudioSession 0x000000019f738f38 + 316 13 AudioSession 0x000000019f738d8c + 156 14 AudioSession 0x000000019f7481c0 + 140 15 Runner 0x00000001025dc728 -[ARTCEngineKit switchAudioCategaryWithSpeaker:] ARTCEngineKit.mm:2013 (in Runner)**

Post not yet marked as solved Up vote post of SheepWolf Down vote post of SheepWolf
594 views