Skip to content

TwilioVoice 3.1.0 Crash - NSInvalidArgumentException #13

Description

@jbohman

Description

I'm trying to use TwilioVoice 3.1.0 (through CocoaPods) and integrate it as a native module in react-native but whenever I try to use connectWithOptions it crashes.

If you need any more information, I'll be happy to help resolve this issue.

Steps to Reproduce

  1. Start app
  2. Navigate to section that uses the native module (from react native)
  3. Wait for server to return access token
  4. Access token is sent to connect function
  5. Crash

Code

I can't share all code, but this is the main part of the code and directly after the last line it crashes.

    var iceServers: Array<TVOIceServer> = Array()
    let iceServer1: TVOIceServer = TVOIceServer(urlString: "stun:global.stun.twilio.com:3478?transport=udp",
                                                username: "",
                                                password: "")
    iceServers.append(iceServer1)

    let iceOptions: TVOIceOptions = TVOIceOptions { (builder) in
        builder.servers = iceServers
    }

    let connectOptions: TVOConnectOptions = TVOConnectOptions(accessToken: token) { (builder) in
        builder.params = [twimlParamTo : toParam]
        builder.iceOptions = iceOptions
    }

    self.call = TwilioVoice.connect(with: connectOptions, delegate: self)

I've tried to run both on the main queue and setup a new serial queue, result is still the same.

Expected Behavior

No crash

Actual Behavior

It crashes with the following trace:

2019-06-01 20:18:45.030495+0200 app[53534:675280] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[5]'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000109c4a6fb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x000000010861cac5 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000109b98ddc _CFThrowFormattedException + 194
	3   CoreFoundation                      0x0000000109cb6c31 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321
	4   CoreFoundation                      0x0000000109c463db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
	5   TwilioVoice                         0x0000000106417840 -[TVOCall publishConnectionEvent:error:] + 1026
	6   TwilioVoice                         0x000000010641ab7c _ZN6twilio5voice20EventObserverAdapter7onEventENSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_NS2_4lessIS9_EENS7_INS2_4pairIKS9_S9_EEEEEE + 1264
	7   TwilioVoice                         0x00000001068254e3 _ZNSt3__110__function6__funcIZN6twilio5voice8CallImpl9postEventERNS_3mapINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEESB_NS_4lessISB_EENS9_INS_4pairIKSB_SB_EEEEEEE4$_37NS9_ISK_EEFvvEEclEv + 227
	8   libdispatch.dylib                   0x000000010db8ed7f _dispatch_call_block_and_release + 12
	9   libdispatch.dylib                   0x000000010db8fdb5 _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x000000010db9d080 _dispatch_main_queue_callback_4CF + 1540
	11  CoreFoundation                      0x0000000109bb18a9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	12  CoreFoundation                      0x0000000109babf56 __CFRunLoopRun + 2310
	13  CoreFoundation                      0x0000000109bab302 CFRunLoopRunSpecific + 626
	14  GraphicsServices                    0x00000001117da2fe GSEventRunModal + 65
	15  UIKitCore                           0x00000001151a5ba2 UIApplicationMain + 140
	16  app                            0x0000000101a72410 main + 112
	17  libdyld.dylib                       0x000000010dc04541 start + 1
	18  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Reproduces How Often

Every time I've tried it

Logs

Versions

All relevant version information for the issue.

Voice iOS SDK

3.1.0 via CocoaPods

Xcode

1.0

iOS Version

12.2

iOS Device

Both simulator (iPhone XR) and real device (iPhone XS)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions