<React/RCTDefines.h> file not found

12,435

Solution 1

Try the following solution-

#if __has_include("RCTDefines.h")
  #import "RCTDefines.h"
#else
 #import <React/RCTDefines.h>
#endif

this works for me.

Solution 2

Go to Project navigator > Libraries > RNFetchBlob.xcodeproj

Click on Build Settings and then the first item under "Targets"

Scroll down to 'Search Paths'

Double click to edit the 'Header Search Paths'

Add the following entry (click '+'): ${SRCROOT}/../../../ios/Pods/Headers.

Make sure to set it to recursive. (DOUBLE CLICK)

Clean (cmd + shift + K) and re-build (cmd + B)

https://github.com/joltup/rn-fetch-blob/issues/461#issuecomment-553355501

Solution 3

You need to make sure you have "RCTDefines" installed in your library list:

C

CLick the plus button at the bottom of the list to add it. Let me know if this helps you or if you need more info :)

Share:
12,435

Related videos on Youtube

Anish
Author by

Anish

Am a UI DEVELOPER

Updated on June 06, 2022

Comments

  • Anish
    Anish almost 2 years

    I am Using cocoapods to install react native and react. I just want to use a toast component(https://www.npmjs.com/package/react-native-simple-toast) which does ti have a cocoapods Installation. when i install and and run the app I am getting an error "" file not found error. I have added header search path but still getting this error. 1)error enter image description here

    2)react-native-simple-toast xcode project Header search path enter image description here

    3) Main project Header search path enter image description here

    • Jason Gaare
      Jason Gaare about 6 years
      When you do a pod install, do you see "React" as one of the pods installed? I suspect that the simple-toast lib has React as a dependency and that may be causing your issue
    • Alper
      Alper about 6 years
      I think you either need to upgrade a bunch of things, or just add this pod in there and see if that works: React/Core
  • Jamie Birch
    Jamie Birch about 6 years
    Also worth running a build for your target after adding that lib to the list. And if you're developing for tvOS, make sure the lib you've selected is architectured for tvOS (often indicated by a -tvos suffix to the lib name) rather than the usual iOS.
  • amit pandya
    amit pandya almost 5 years
    Hi @ShaneG for me RCTDefines is not showing in the list while adding it in library dependencies. Help please.
  • amit pandya
    amit pandya over 4 years
    @red-devil I haven't solved it. For that I have asked for help.
  • iiro
    iiro over 4 years
    Why do you remove RNVectorIconsManager.m file? isin't that necessary? Anyway, i have exactly same problem. When I add one library, it imports "RCTBridgeModule.h" and that imports React/RCTDefines.h that is not found. I am stuck...
  • darkheartfelt
    darkheartfelt over 4 years
    @amitpandya yeah you have to Add Other and dig it out...btw didn't work for me
  • Dhivya Dandapani
    Dhivya Dandapani over 4 years
    @iiro: Good question. But AFAIK, even after the removal of RNVectorIconsManager.m, nothing broke in my app related to the library. So went along with the fix. On a different note, was the above solution able to unblock you.
  • iiro
    iiro over 4 years
    no, i don't have that library, but if I install this plugin github.com/Driversnote-Dev/react-native-kontaktio the xcode gives same error. Very Annoying! Either the library is not linked or when it is linked, the project cannot be built!
  • Yossi
    Yossi about 4 years
    @darkheartfelt are you talking about RCTDefines.h? And you added it to the library list, although it is not a library? Or did you create a headers phase in build phases?
  • darkheartfelt
    darkheartfelt almost 4 years
    @yossi this ended up being a much more severe issue where I had different versions of NPM and react was caching some older version everytime. I don't remember what I did but this wasn't the answer. If rctdefines is messed up like this it points to a larger issue of setup, not just a missing RCTDefines import or something like that.