react-native-camera-kit
react-native-camera-kit copied to clipboard
fatal error: 'ReactNativeCameraKit-Swift.h' file not found #import "ReactNativeCameraKit-Swift.h"
Hi, im using the last version "react-native-camera-kit": "14.0.0-beta11" with react native 0.72.4 and when try build in ios the build crash:
node_modules/react-native-camera-kit/ios/ReactNativeCameraKit/CKTypes+RCTConvert.m:14:9: fatal error: 'ReactNativeCameraKit-Swift.h' file not found #import "ReactNativeCameraKit-Swift.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
Did you update from an older version or this is a fresh install?
ReactNativeCameraKit-Swift.h is supposed to be generated by Xcode at build time
If you open the xcworkspace in Xcode, it should appear in Pods > ReactNativeCameraKit > Build Settings > Swift Compiler - General > Objective-C Generated Interface Header Name
Could you check and give us more context?
Did you update from an older version or this is a fresh install?
ReactNativeCameraKit-Swift.his supposed to be generated by Xcode at build time If you open the xcworkspace in Xcode, it should appear inPods>ReactNativeCameraKit>Build Settings>Swift Compiler - General>Objective-C Generated Interface Header NameCould you check and give us more context?
This happened to me too! I installed it freshly.
We going to need more details about your context, it is most likely a configuration issue within your Xcode project.
A fresh project
npx create-expo-app ReactNativeAppIssueTest
cd ReactNativeAppIssueTest
npx expo run:ios
npm i [email protected]
Add that in ios/ReactNativeAppIssueTest/Info.plist
<key>NSCameraUsageDescription</key>
<string>For taking photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For saving photos</string>
Update App.js with
import { Camera } from 'react-native-camera-kit';
export default function App() {
return (
<Camera style={{
width: "100%",
height: "100%",
}}/>
);
}
Does compile and run as expected
You need to find what changes between a fresh Xcode project like that one and your Xcode project - that might be older and setup differently
If you work on an older project that has been built multiple times before adding this dependency, it worth trying to delete Xcode derived data.
rm -rf ~/Library/Developer/Xcode/DerivedData/<Your_Project>-<Random_Hash>
It forces Xcode to rebuild everything from a clean state the next time you run your app
Happening for me also. i upgraded from previous 13.0.0 version to the latest 14.0.0 beta versions (12)
We going to need more details about your context, it is most likely a configuration issue within your Xcode project.
A fresh project
npx create-expo-app ReactNativeAppIssueTest cd ReactNativeAppIssueTest npx expo run:ios npm i [email protected]Add that in
ios/ReactNativeAppIssueTest/Info.plist<key>NSCameraUsageDescription</key> <string>For taking photos</string> <key>NSPhotoLibraryUsageDescription</key> <string>For saving photos</string>Update
App.jswithimport { Camera } from 'react-native-camera-kit'; export default function App() { return ( <Camera style={{ width: "100%", height: "100%", }}/> ); }Does compile and run as expected
You need to find what changes between a fresh Xcode project like that one and your Xcode project - that might be older and setup differently
I saw you used expo, but it didn't work on bare project.
The best way to avoid guesses is to share reproduction steps. Without that, I won’t be able to help you much further.
i am also facing same issue on android side it is working fine and also before making build for real device it was working fine but after that suddenly got this error like "'ReactNativeCameraKit-Swift.h' file not found" so i don't know what to do this i also clear cache for xcode deleted the Derived files also but till now not working.
Yes one thing is that i have an exiesting project in which i am getting this issue (where react-native version is 0.71.7), but on testing or demo project the error is not getting(where react-native version is 0.72.6.
Same problem. I seem to have been able to get a build working by copying ReactNativeCameraKit-Swift.h from:
ios/build/Debug-iphonesimulator/ReactNativeCameraKit/ReactNativeCameraKit.framework/Headers
to
node_modules/react-native-camera-kit/ios/ReactNativeCameraKit/
This "solution" is obviously pretty dubious, so just sharing in case it helps anyone with troubleshooting.
Hello,
i have the same problem. it comes from the fact that i changed my podFile to useFramework! > static
this is mandatory if you use Firebase modules.
Still now i am facing the same issue as i mentioned but no solution was found yet. Yes Mr. @rocket13011 you are right that use_frameworks! :linkage => :static is needed for the firebase. In the demo or fresh project every thing is working but in existing project we are facing that issue
Please find solution as soon as possible
and another thing is yes it not creating ReactNativeCameraKit-Swift.h file in exeisting project but in newly generated project it generate automatically the path i am unable to found.
So please give any solution as soon as possible
Same problem. I seem to have been able to get a build working by copying ReactNativeCameraKit-Swift.h from:
ios/build/Debug-iphonesimulator/ReactNativeCameraKit/ReactNativeCameraKit.framework/Headers
to
node_modules/react-native-camera-kit/ios/ReactNativeCameraKit/
This "solution" is obviously pretty dubious, so just sharing in case it helps anyone with troubleshooting.
but this solution only works when you run on simulator, when you make build for real device it getting error the same error although some more error are adding with it so thanks for the suggestion.
I'm developing React Native in an Nx monorepo and I need statically linked Frameworks.
What worked for me was to set ReactNativeCameraKit to also use statically linked Frameworks by adding the following to my Podfile.
use_frameworks! :linkage => :static
target 'MyApp' do
# ...
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('ReactNativeCameraKit')
def pod.build_type
Pod::BuildType.static_library
end
end
end
end
# ...
The above solutions isn't working anymore
After upgrading to v14.1.0, I had to remove the pod preinstall workaround to make it works.
