react-native-vision-camera: [V2] iOS - App Crashes at Launch when built with Xcode 15
What’s happening?
When built using Xcode 15 release candidate, the app is crashing at launch. Before the crash, the message Swift class extensions and categories on Swift classes are not allowed to have +load methods
is printed to the console.
Relevant info - I’m also using vision-camera-code-scanner@0.2.0
for barcode scanning.
It seems to be related to https://github.com/mrousavy/react-native-vision-camera/pull/1308. If I revert that change, the startup crash goes away, but then when trying to use the camera it lags and then crashes (probably the original issue)
My workaround for now is continuing to use Xcode 14 to build.
Reproduceable Code
N/A
Relevant log output
Code Type: X86-64 (Native)
Role: Foreground
Parent Process: launchd_sim [26423]
Coalition: com.apple.CoreSimulator.SimDevice.249DDD8B-78A4-4847-98B3-29645FFF9567 [76346]
Responsible Process: SimulatorTrampoline [24850]
Date/Time: 2023-08-25 16:33:58.9305 -0400
Launch Time: 2023-08-25 16:33:57.5265 -0400
OS Version: macOS 13.5.1 (22G90)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: OBJC 1
Triggered by Thread: 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x114d49a52 __abort_with_payload + 10
1 libsystem_kernel.dylib 0x114d6784e abort_with_payload_wrapper_internal + 82
2 libsystem_kernel.dylib 0x114d677fc abort_with_reason + 19
3 libobjc.A.dylib 0x7ff800057593 _objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 121
4 libobjc.A.dylib 0x7ff80005751a _objc_fatal(char const*, ...) + 114
5 libobjc.A.dylib 0x7ff80004166d load_images + 1383
6 dyld_sim 0x11389509b dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*) + 359
7 dyld_sim 0x11389a73c dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 182
8 dyld_sim 0x11389d49a dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_1::operator()() const + 92
9 dyld_sim 0x11389a7dd dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 93
10 dyld_sim 0x1138b03df dyld4::APIs::runAllInitializersForMain() + 263
11 dyld_sim 0x11388c10a dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2535
12 dyld_sim 0x11388b356 _dyld_sim_prepare + 854
13 dyld 0x117f55424 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1490
14 dyld 0x117f53abc dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 249
15 dyld 0x117f533bd start + 1805
Camera Device
N/A
Device
iPhone 14 Pro
VisionCamera Version
2.15.4
Can you reproduce this issue in the VisionCamera Example app?
- I can reproduce the issue in the VisionCamera Example app.
Additional information
- I am using Expo
- I have enabled Frame Processors (react-native-worklets-core)
- I have read the Troubleshooting Guide
- I agree to follow this project’s Code of Conduct
- I searched for similar issues in this repository and found none.
Upvote & Fund
- We’re using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 25
- Comments: 48 (2 by maintainers)
Commits related to this issue
- Apply changes based on comments in https://github.com/mrousavy/react-native-vision-camera/issues/1802#issuecomment-1735681593 — committed to gt-arylla/react-native-vision-camera by gt-arylla 8 months ago
I’m on version 2.15.4 and had to replace
with
in two lines in the file
./ios/Frame Processor/FrameProcessorPlugin.h
:https://github.com/mrousavy/react-native-vision-camera/blob/9963f4dedc6fbef933fb99e0adca1343f4f5f972/ios/Frame Processor/FrameProcessorPlugin.h#L36
https://github.com/mrousavy/react-native-vision-camera/blob/9963f4dedc6fbef933fb99e0adca1343f4f5f972/ios/Frame Processor/FrameProcessorPlugin.h#L56
This avoids the initial crash. Haven’t tried the camera which I assume will crash as stated in https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1727739161.
This patch worked for me!
react-native: 0.71.13 react-native-camera-vision: 2.15.4 xcode: 15 macos: 14.0
Create file patch with name -> ./patches/react-native-vision-camera+2.15.4.patch
Past content below to file
npx patch-package
Same issue after updating to xcode 15
So basically the breaking change from Xcode 13 -> 14 is now reverted with Xcode 14 -> 15? 😂
Thank you, that’s worked for me!
Note: I am using RN 0.68.2 here.
@Thormeard, it’s final change, worked for me. But only to “react-native-vision-camera”: “2.15.2”, if I update “react-native-vision-camera” to 2.16.1 I got error(Frame processors not enabled) again, I don’t know why .
If you have patch-package you can apply this:
Also If you have firebase with
use_frameworks! :linkage => :static
in your pods this can help you (this case give same error: Frame processors not enabled ):https://github.com/mrousavy/react-native-vision-camera/issues/1840#issuecomment-1734259756
Same issue here. It works with Xcode 14, but can’t build for iOS 17.
Facing the same issue. App crashes on launch.
Yep, same issue. Xcode 15 (15A240d).
Facing the same issue! Any workarounds for this on xcode 15?
And to make v2 work on iPhone 15 you need to add the following to your patch, and build using xcode 15/ios skd 17
Hi, got the same issue. (2.16.1) Managed to fix crashing on startup with https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1731248952 But still got an error when trying to use frame processor:
frame-processor/unavailable: Frame Processors are not enabled.
Anything else im missing?
My FrameProcessorPlugin.h
@gabrielmaldi @DanielAraldi be warned (I mentioned this in my original comment), the reversion fixes the startup crash but the original crash (using the camera with a frame processor) will pop back up, making the fix unusable
The quick fix for now is to revert this change - https://github.com/mrousavy/react-native-vision-camera/pull/1308/files
Replacing
vision-camera-code-scanner
withreact-native-camera-kit
.That solved the issue for me.
@ms314006 Just keep using Xcode 14 for now. I recommend using https://github.com/XcodesOrg/xcodes to manage Xcode versions. But we need to get this resolved eventually, because at some point next year Apple will likely require Xcode 15 for submissions.
@phatmovista Yes, but unfortunately reverting it is not an option because the app crashes when using the camera (the original reason the change was put in: https://github.com/mrousavy/react-native-vision-camera/pull/1308)
Same issue here 😭, This message is printed to the xcode15 console before crashed:
@marcshilling Do you have any solution for the issue? I will be grateful for anything you can reply. 🙏
gettins this issue also on xcode 15 + iOS 17+ vision camera 3.3.1.
Hey - yea please submit a PR instead of creating random patches. Then I can merge and backport it.
Can confirm, fixes issue for me BUT only on 2.15.2 (not on latest 2.16.1). Thanks!
Xcode 15, ios 17, iPhone X
This should solve the issue permanently - https://github.com/mrousavy/react-native-vision-camera/issues/1307#issuecomment-1731248952
crash is resolved with this. thx
however I can’t use camera.
Yes, this is a temporary fix to be able to at least work on the rest of the app. Thanks a lot.