Stop iOS crashing when answering a call whose invite is already gone - #3
Merged
Conversation
When CallKit delivers an answer action after the CallInvite has already been removed from callInviteMap (call cancelled/ended or already answered), the NSAssert guarding it is compiled out in release builds, so execution fell through to +[TVOAcceptOptions optionsWithCallInvite:] with a nil invite, raising NSInvalidArgumentException and crashing the app. Bail out gracefully instead, so answering a since-ended call is a no-op. Ported from closeio/close-mobile#643. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
treycucco
approved these changes
Aug 3, 2026
|
Interestingly, it looks like Twilio's referenced PR only handled android, and ours only handles Android? Do we not have this issue on Android? |
Collaborator
Author
this is the android side fix #4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Guards
performAnswerVoiceCallWithUUID:completion:inios/TwilioVoiceReactNative+CallKit.magainst a missingCallInvite. If CallKit delivers an answer action after the invite has already been removed fromcallInviteMap(the call was cancelled/ended, or already answered), the method now logs, calls the completion handler withNO, and returns instead of proceeding with a nil invite.Why
The existing
NSAssertis compiled out in release builds (NS_BLOCK_ASSERTIONS), so execution fell through to+[TVOAcceptOptions optionsWithCallInvite:]with a nil invite, which raisesNSInvalidArgumentException("A call invite is required.") and crashes the app. With this change, answering a since-ended call is a graceful no-op.In our production crash reporting this is the single largest native crash on the app — roughly 49,800 lifetime events across ~750 users (issue links on the internal PR referenced below).
Ported from closeio/close-mobile#643 as part of the fork migration.
Upstream candidate
This is a strong candidate to upstream: twilio/twilio-voice-react-native recently landed an attempt at this exact problem class (their PR twilio#695, "[VBLOCKS-6682] feat: ignore accept and reject for invalid callinvites") and then reverted it in twilio#699, so the underlying crash is still unaddressed upstream.
🤖 Generated with Claude Code