react-native-webrtc / react-native-webrtc/react-native-callkeep

Crash on sendEventWithNameWrapper didDeactivateAudioSession?

Open
#347 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
511
Avg merge
9h 12m
Merged PRs (30d)
2

Description

Bug report

  • [x ] I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • [ x] iOS

Description

This should be an easy one. When ending a call, my app crashes because the sendEventWithNameWrapper method crashes with:

'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert `nil` object from objects[1]'

This is because the body argument passed in is nil.

Screenshot 2021-01-15 at 12 02 19

But this seems to be how it is invoked though: https://github.com/react-native-webrtc/react-native-callkeep/blob/master/ios/RNCallKeep/RNCallKeep.m#L766

Not that experienced in Obj-c, but how is passing a body of nil ever supposed to work? NOTE: When I add in the ternary expression you see in the screenshot, it does not crash. Original code: https://github.com/react-native-webrtc/react-native-callkeep/blob/c3ade440bb19ef27d6b8a6a410defd69032c2e34/ios/RNCallKeep/RNCallKeep.m#L123

Steps to Reproduce

Start a call and then end it? Do not subscribe an event listener to didEndAudioSession as that will invoke a different code branch (sending the event to the listener, which works even as body is nil)

Should the lib's source code just be updated to include my ternary expression as above? Happy to submit a PR!

Versions

- Callkeep: 4.0.1
- React Native: 0.63.4
- iOS: 12.3
- Android:
- Phone model: iPhone 11

Logs

2021-01-15 12:17:09.935296+0000 vTail[368:6649] [RNCallKeep][CXProviderDelegate][provider:didActivateAudioSession]
2021-01-15 12:17:10.106524+0000 vTail[368:6649] [RNCallKeep][configureAudioSession] Activating audio session
2021-01-15 12:17:13.501954+0000 vTail[368:6836] [RNCallKeep][endCall] uuidString = 7cf7a9db-a1f0-4025-93d8-da8fabad111f
2021-01-15 12:17:13.502594+0000 vTail[368:6836] [RNCallKeep][requestTransaction] transaction = <CXTransaction 0x2822d1ea0 UUID=6BEEF4C7-F7A8-4B1A-BA34-C29DBF5F5AD7 isComplete=0 actions=(
    "<CXEndCallAction 0x283748040 UUID=5D3D2904-D165-4BA6-A343-2F6C8835F6E0 state=0 commitDate=(null) callUUID=7CF7A9DB-A1F0-4025-93D8-DA8FABAD111F dateEnded=(null)>"
)>
2021-01-15 12:17:13.504321+0000 vTail[368:7148] [RNCallKeep][requestTransaction] Requested transaction successfully
2021-01-15 12:17:13.505895+0000 vTail[368:6649] [RNCallKeep][CXProviderDelegate][provider:performEndCallAction]
2021-01-15 12:17:13.775340+0000 vTail[368:7142] [aurioc] AURemoteIO.cpp:1598:Start: AUIOClient_StartIO failed (1701737535)
2021-01-15 12:17:13.798428+0000 vTail[368:6649] [RNCallKeep][CXProviderDelegate][provider:didDeactivateAudioSession]
2021-01-15 12:17:13.798807+0000 vTail[368:6649] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(0x189f9c878 0x19e4f2c50 0x18a00ce1c 0x18a019270 0x189e8d550 0x189e7fdd0 0x102501294 0x102506a8c 0x1a8b16360 0x1085bbbcc 0x1085bd6c0 0x1085ccf34 0x189f1811c 0x189f12120 0x189f1121c 0x1a0f90784 0x18c94a200 0x18c94fa74 0x10236902c 0x189bd16c0)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
terminating with uncaught exception of type NSException

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ios/RNCallKeep/RNCallKeep.m, especially sendEventWithNameWrapper and the didDeactivateAudioSession call around line 766; compare it with the referenced implementation near line 123. Reproduce by starting and ending a call without a didEndAudioSession listener, then verify that the nil body no longer crashes the iOS app.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c, react-native
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.