mrousavy/react-native-vision-camera

'VisionCamera/VisionCamera.h' file not found🐛

moygospadin opened this issue · 7 comments

What were you trying to do?

I trying to build my own frame process plugin. I have the following error - could not build module 'VisionCamera', Bridging-Header make like in example. Trying to set swift version to 5.2. Clean and rebuild all. Nothing helped
Снимок экрана 2022-05-12 в 19 19 37
My Bridging-Header content
Снимок экрана 2022-05-12 в 19 21 04
I have the following file structure
Снимок экрана 2022-05-12 в 20 19 08

My package json

"@expo/react-native-action-sheet": "^3.13.0",
    "@gorhom/bottom-sheet": "^4",
    "@gorhom/portal": "^1.0.13",
    "@react-native-async-storage/async-storage": "^1.16.1",
    "@react-native-community/blur": "3.6.0",
    "@react-navigation/bottom-tabs": "^6.2.0",
    "@react-navigation/native": "^6.0.8",
    "@react-navigation/native-stack": "^6.5.0",
    "@rneui/base": "^4.0.0-rc.1",
    "@rneui/themed": "^4.0.0-rc.1",
    "@types/lodash.isequal": "^4.5.5",
    "@types/react-native-snap-carousel": "^3.8.5",
    "axios": "^0.26.0",
    "buffer": "^6.0.3",
    "date-fns": "^2.28.0",
    "form-data": "^4.0.0",
    "formik": "^2.2.9",
    "i18next": "^21.6.12",
    "i18next-http-backend": "^1.4.0",
    "lodash.clonedeep": "^4.5.0",
    "lodash.debounce": "^4.0.8",
    "lodash.isempty": "^4.4.0",
    "lodash.isequal": "^4.5.0",
    "mobx": "^6.4.2",
    "mobx-devtools-mst": "^0.9.30",
    "mobx-react-lite": "^3.3.0",
    "mobx-state-tree": "^5.1.3",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "qs": "^6.10.3",
    "querystring": "^0.2.1",
    "react": "17.0.2",
    "react-i18next": "^11.15.5",
    "react-native": "0.67.3",
    "react-native-compressor": "^1.5.2",
    "react-native-config": "^1.4.5",
    "react-native-currency-input": "^1.0.1",
    "react-native-date-picker": "^4.2.0",
    "react-native-flash-message": "^0.2.1",
    "react-native-fs": "^2.19.0",
    "react-native-gesture-handler": "^2.4.1",
    "react-native-image-picker": "^4.7.3",
    "react-native-network-logger": "^1.12.0",
    "react-native-permissions": "^3.3.1",
    "react-native-photo-editor": "1.0.13",
    "react-native-reanimated":  "^2.8.0",
    "react-native-safe-area-context": "^4.0.1",
    "react-native-screens": "^3.13.1",
    "react-native-shake": "^5.1.1",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "^12.1.1",
    "react-native-table-component": "^1.2.2",
    "react-native-text-size": "^4.0.0-rc.1",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-vision-camera": "^2.13.3",
    "react-native-web": "^0.17.7",
    "react-query": "^3.34.16",
    "yup": "^0.32.11"

Reproduceable Code

No response

What happened instead?

Снимок экрана 2022-05-12 в 19 25 41

Relevant log output

No response

Device

XCODE Version 13.3 (13E113)

VisionCamera Version

2.13.3

Additional information

replace content in Bridging-header to this

#import "FrameProcessorPlugin.h"
#import "Frame.h"

in another files use this imports like upper
also move bringing header to FrameProcessorPlugin folder (dont know helps it or not)
also dont forget to check brinding header path
Снимок экрана 2022-05-13 в 12 58 26
also i off parallelize build in xcode
then it works

One more update: main problem was, that i use use_framework, i commented it, and add to necessary pods :modular_headers => true, uncommented use_flipper!. And DONE!

This is a bad decision. For some projects, the use of use_framework is mandatory. Are there any solutions here?

@moygospadin Do you have any other solution instead of commenting use_framework,
Please share this here if you have.

In case anyone is still looking at this, I have a solution. If you patch the VisionCamera package to create an empty VisionCamera.h file and reference in the podspec as in https://github.com/rodgomesc/vision-camera-code-scanner/blob/4dcfeabd3cd41564257e3ec1b0824f3a39b15014/.yarn/patches/react-native-vision-camera-https-95cda75d0b.patch, that fixes the compile error and the project works with use_framework. This patch is based on the newer V3 branch of react-native-vision-camera though so ymmv with the latest V2 release.

Found a solution

The problem is using this use_frameworks! in your PodFile
most people are using use_frameworks! due to firebase v15+ requirement

so if you are using use_frameworks! for any reason
remove it and use :module_headers => true instead for each library due to which you used use_frameworks! earlier

in case of firebase, after remover use_frameworks!
you can add the following line at the end of Podfile

pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true

you might need to turn off flipper too by commenting out this following line (for firebase, not sure about any other library)
:flipper_configuration => flipper_config,

This should work fine. now you will be able to use your frame processors.

Hope that helps

For anyone reaching this comment, trying everything written before... remember to installreact-native-worklets-core plugin and configure it in babel.
https://react-native-vision-camera.com/docs/guides/frame-processors#react-native-worklets-core

This was the culprit in my case.