Description
We are experiencing a crash that occurs when our app is launched for the first time
while an incoming cellular phone call (not through Twilio) arrives simultaneously.
Based on the crash log, it appears that self.selectedAudioDevice may be nil at the
time voice_getAudioDevices is called, likely because the audio session hasn't been
fully initialized yet. The NSDictionary literal at TwilioVoiceReactNative.m:625
does not seem to handle this case, which causes a SIGABRT.
This seems similar in nature to the issue fixed in 1.7.0 (application that got crashed uses 1.6.1) for the call contact handle
template (where a null handle template was returned when the React Native JS runtime
was not initialized).
Steps to reproduce
- Install the app for the first time (or delete and reinstall)
- Open the app
- Receive an incoming cellular call at the same moment the app is launching
Actual behavior
App crashes with SIGABRT:
Exception Reason: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]:
attempt to insert nil object from objects[1]
Crash location
Based on the backtrace, the crash originates from TwilioVoiceReactNative.m:625
in -[TwilioVoiceReactNative voice_getAudioDevices:rejecter:].
Looking at the source, it seems like this could be the problematic line:
resolve(@{kTwilioVoiceReactNativeAudioDeviceKeyAudioDevices: nativeAudioDeviceInfos,
kTwilioVoiceReactNativeAudioDeviceKeySelectedDevice: self.selectedAudioDevice});
Possible fix
As a workaround, we patched the code to conditionally include selectedAudioDevice
only when it is non-nil:
NSMutableDictionary *payload = [NSMutableDictionary dictionaryWithDictionary:@{
kTwilioVoiceReactNativeAudioDeviceKeyAudioDevices: nativeAudioDeviceInfos
}];
if (self.selectedAudioDevice != nil) {
payload[kTwilioVoiceReactNativeAudioDeviceKeySelectedDevice] = self.selectedAudioDevice;
}
resolve(payload);
We are not sure if this is the correct approach or if there are other implications.
Crash log
Incident Identifier: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Hardware Model: iPhone14,5
Process: MyApp [3571]
Identifier: com.example.myapp
Version: 0.6.2 (18)
Code Type: ARM-64 (Native)
Date/Time: 2026-02-11 09:18:49.1879 -0800
Launch Time: 2026-02-11 09:18:48.3111 -0800
OS Version: iPhone OS 18.5 (22F76)
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]
Termination Reason: SIGNAL 6 Abort trap: 6
Triggered by Thread: 8
Last Exception Backtrace:
0 CoreFoundation 0x19e97f21c __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x19be19abc objc_exception_throw + 88 (objc-exception.mm:356)
2 CoreFoundation 0x19e96dbd8 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 724
3 CoreFoundation 0x19e88fca0 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
4 MyApp 0x10501b7d4 -[TwilioVoiceReactNative voice_getAudioDevices:rejecter:] + 404 (TwilioVoiceReactNative.m:625)
5 CoreFoundation 0x19e894a94 __invoking___ + 148
6 CoreFoundation 0x19e89410c -[NSInvocation invoke] + 424
7 CoreFoundation 0x19e906b2c -[NSInvocation invokeWithTarget:] + 64
8 MyApp 0x104cbd1f0 facebook::react::ObjCTurboModule::performMethodInvocation(...) + 96 (RCTTurboModule.mm:370)
Environment
- @twilio/voice-react-native-sdk: 1.6.1
- iOS: 18.5
- Device: iPhone 13 (iPhone14,5)
- React Native with Hermes
Description
We are experiencing a crash that occurs when our app is launched for the first time
while an incoming cellular phone call (not through Twilio) arrives simultaneously.
Based on the crash log, it appears that
self.selectedAudioDevicemay benilat thetime
voice_getAudioDevicesis called, likely because the audio session hasn't beenfully initialized yet. The
NSDictionaryliteral atTwilioVoiceReactNative.m:625does not seem to handle this case, which causes a
SIGABRT.This seems similar in nature to the issue fixed in 1.7.0 (application that got crashed uses 1.6.1) for the call contact handle
template (where a
nullhandle template was returned when the React Native JS runtimewas not initialized).
Steps to reproduce
Actual behavior
App crashes with
SIGABRT:Exception Reason: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]:
attempt to insert nil object from objects[1]
Crash location
Based on the backtrace, the crash originates from
TwilioVoiceReactNative.m:625in
-[TwilioVoiceReactNative voice_getAudioDevices:rejecter:].Looking at the source, it seems like this could be the problematic line:
Possible fix
As a workaround, we patched the code to conditionally include selectedAudioDevice
only when it is non-nil:
We are not sure if this is the correct approach or if there are other implications.
Crash log
Environment