Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build failed 'React/RCTBridgeModule.h' file not found

I spent my day trying to fix my problem, I tried every solution I found in other SO posts but unfortunately I can't figure out how to solve my problem.

I try to integrate TouchID inside my react-native project. I downloaded a npm package called "react-native-touch-id" (sounds perfects !). I followed installation guide and I manually linked library to my project.

But when I try to run application I get the following error :

main problem image enter image description here

I tried to clean my project :

  • rm -rf node_modules
  • yarn cache clean && yarn install
  • rm -rf ios/Pods/ && pod install

In xCode I even clean the build folder.

About my versions :

  • RN : 0.57.4
  • xCode : 10.1
  • react-native-touch-id : 4.3.0

Here's my Podfile :

def available_pods
  pod 'TouchID', :path => "../node_modules/react-native-touch-id"
end
target 'App' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  available_pods
end

I added the .xcodeproj of react-native-touch-id package inside my project's libraries directory and in Build Phases I linked it.

enter image description here enter image description here

But I still getting the same error again and again ... I don't understand why ... If someone have an idea some help would be really appreciated :)

like image 644
Hurobaki Avatar asked Nov 29 '18 14:11

Hurobaki


People also ask

How do I create a react native library?

Open the package. json file and under name — change react-native-native-toast-library to react-native-native-toast-library-XXXX, where XXXX is your unique part. If you don't have an npm account create it [here]. Open the terminal in the project directory, and type npm adduser and then your username details.

What is React native used for?

React Native is an open-source UI software framework created by Meta Platforms, Inc. It is used to develop applications for Android, Android TV, iOS, macOS, tvOS, Web, Windows and UWP by enabling developers to use the React framework along with native platform capabilities.


1 Answers

It appeared the problem was the Podfile. It seems that Podfile use its own Podspec which caused troubles. So I simply delete the TouchId pod declaration from my Podfile, clean and re-install my pods.

Then, I manually linked the library to my xcode workspace. To do that, under your project name, Right Click on Libraries directory => Add files to "your project name" => Add the xcodeproj of the npm's package located inside your node_modules directory.

After that, in your project Build Phases under the Link Binary with Libraries you have to add the npm's package static library (example libTouchID.a in my case).

To be sure you can clean your project and try to rebuild, it should work now.

For information, I kept all of my softwares version I mentionned above.

like image 175
Hurobaki Avatar answered Sep 20 '22 03:09

Hurobaki