Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: iOS crash when BlobModule is nil in RCTNetworking initialization #50211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hoonjoo-park
Copy link
Contributor

Summary:

An iOS crash occurs during networking module initialization in uncertain situations. This happens in the RCTAppSetupUtils.mm file when setting up URL handlers for the RCTNetworking class and BlobModule is nil.

this PR fixes this issue #50210

Changelog:

[IOS] [FIXED] - Fix app crash in RCTNetworking when BlobModule is nil by adding null check before adding it to handlers array

Test Plan:

  1. Created a test environment where BlobModule is not available/initialized
  2. Before the fix, the app crashes when attempting network requests with the error: "Collection element of type 'std::nullptr_t' is not an Objective-C object"
  3. After applying the fix, the app successfully initializes the networking module without crashing
  4. Verified network requests work properly even when BlobModule is not available
  5. Also verified that when BlobModule is properly initialized, it still works as expected with all functionality intact

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 24, 2025
@hoonjoo-park hoonjoo-park changed the title Fix iOS crash when BlobModule is nil in RCTNetworking initialization Fix: iOS crash when BlobModule is nil in RCTNetworking initialization Mar 24, 2025
@hoonjoo-park hoonjoo-park changed the title Fix: iOS crash when BlobModule is nil in RCTNetworking initialization fix: iOS crash when BlobModule is nil in RCTNetworking initialization Mar 24, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Mar 24, 2025
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi thanks for the PR. However, I don't think we can merge it.
The BlobModule is something provided by React Native and the module needs to be part of those handlers or some features will stop working.

Rather than fixing it this way, I would like to understand better why the BlobModule is not initialized properly in your app.

This fix will cure a symptom, not the root cause.

@hoonjoo-park
Copy link
Contributor Author

@cipolleschi I fully agree with your assessment. 👍
I’m aware that the PR I submitted is likely not a good solution, and I'm still investigating the root cause of why BlobModule is not being initialized.
Based on our crash reports, the issue predominantly occurs on older devices such as the iPhone 7 Plus and iPhone 6.

@cipolleschi
Copy link
Contributor

it would help if you can tell us about what the user is doing in the app.
Is perhaps navigating quickly from a RN surface to a native surface and back to a RN one?
The assumption is that there might be a race condition when React Native is teared down and recreated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS: App crashes when BlobModule is nil during RCTNetworking initialization
3 participants