react-native-camera-kit icon indicating copy to clipboard operation
react-native-camera-kit copied to clipboard

fatal error: 'ReactNativeCameraKit-Swift.h' file not found #import "ReactNativeCameraKit-Swift.h"

Open joseAlvarezTenpo opened this issue 2 years ago • 13 comments

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.

joseAlvarezTenpo avatar Sep 01 '23 00:09 joseAlvarezTenpo

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?

DavidBertet avatar Sep 06 '23 04:09 DavidBertet

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?

This happened to me too! I installed it freshly.

imdangle avatar Sep 12 '23 02:09 imdangle

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 react Medium

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

DavidBertet avatar Sep 22 '23 19:09 DavidBertet

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

DavidBertet avatar Sep 22 '23 19:09 DavidBertet

Happening for me also. i upgraded from previous 13.0.0 version to the latest 14.0.0 beta versions (12)

nateshmbhat avatar Oct 03 '23 08:10 nateshmbhat

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 react Medium

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.

imdangle avatar Oct 17 '23 06:10 imdangle

The best way to avoid guesses is to share reproduction steps. Without that, I won’t be able to help you much further.

DavidBertet avatar Oct 17 '23 07:10 DavidBertet

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.

Siliconvelly avatar Oct 20 '23 06:10 Siliconvelly

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.

pmclachlan avatar Nov 06 '23 18:11 pmclachlan

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.

rocket13011 avatar Nov 09 '23 11:11 rocket13011

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

Screenshot 2023-12-23 at 5 02 26 PM

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

Siliconvelly avatar Dec 23 '23 11:12 Siliconvelly

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.

Siliconvelly avatar Dec 23 '23 12:12 Siliconvelly

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
# ...

nzcodarnoc avatar Feb 01 '24 02:02 nzcodarnoc

The above solutions isn't working anymore

sujathasperi2022 avatar Dec 09 '24 10:12 sujathasperi2022

After upgrading to v14.1.0, I had to remove the pod preinstall workaround to make it works.

angelica-snowit avatar Jan 08 '25 10:01 angelica-snowit