There is a crash in my app.
the crash thread is
0 | libsystem_kernel.dylib | ___abort_with_payload() |
1 | libsystem_kernel.dylib | ___darwin_check_fd_set_overflow.cold.1() |
2 | TCC | ___TCCAccessRequest_block_invoke.136() |
3 | TCC | ___CRASHING_DUE_TO_PRIVACY_VIOLATION__() |
4 | TCC | ___tccd_send_message_block_invoke() |
5 | libxpc.dylib | __xpc_connection_reply_callout() |
6 | libxpc.dylib | __xpc_connection_call_reply_async() |
7 | libdispatch.dylib | __dispatch_client_callout3() |
8 | libdispatch.dylib | __dispatch_mach_msg_async_reply_invoke() |
9 | libdispatch.dylib | __dispatch_kevent_worker_thread() |
10 | libsystem_pthread.dylib | __pthread_wqthread() |
and the main thread is always calling
UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord;
status = AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
sizeof (sessionCategory),
&sessionCategory);
UInt32 audioRouteOverride = [[self class] isHeadsetPluggedIn] ?
kAudioSessionOverrideAudioRoute_None: kAudioSessionOverrideAudioRoute_Speaker;
size_t aroSize = sizeof(audioRouteOverride);
status = AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
(unsigned)aroSize,
&audioRouteOverride);
This is only happened in iOS 13.4.1. Not all of the users with iOS 13.4.1 will find this bug, but if the user meet it, he will crash everytime when call AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, (unsigned)aroSize, &audioRouteOverride);
I have already added NSMicrophoneUsageDescription into my info.plist.