rn-fetch-blob icon indicating copy to clipboard operation
rn-fetch-blob copied to clipboard

'React/RCTDefines.h' file not found

Open tzwickl opened this issue 5 years ago • 18 comments

Hi,

Installed Versions:

  • "react-native": "0.61.2"
  • "rn-fetch-blob": "^0.11.2"

we recently upgraded from react-native version 0.59 to 0.61 and now the rn-fetch-blob library no longer works with XCode, we get the following errors when trying to build the project:

Screenshot 2019-10-11 at 5 47 33 PM

In the error stack trace it says that the error originates from node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.h:22

Any ideas or pointers on how we can solve this issue?

Thanks in advance for your support.

Best regards, Thomas

tzwickl avatar Oct 11 '19 16:10 tzwickl

Sounds like it might be a library configuration issue. Are you using the new podfile base autolinking?

alpha0010 avatar Oct 11 '19 18:10 alpha0010

Yes we use the podfile base autolinking. We now downgraded to version 0.60 and now it works :) Seems like it is only an issue with version 0.61 and above

tzwickl avatar Oct 11 '19 19:10 tzwickl

is there a way to fix it for 0.61.2 we have exactly the same issue?

romk1n avatar Oct 22 '19 16:10 romk1n

actually downgrading to 0.60.6 didn't solve a problem for us :(

romk1n avatar Oct 22 '19 17:10 romk1n

Do native libraries work at all for you? For example, can you successfully use something like react-native-webview?

Also, if you have an old version of Xcode, you may need to update it to at least 10.

alpha0010 avatar Oct 23 '19 21:10 alpha0010

I found a work around by adding a condition in the import:

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

josectobar avatar Oct 28 '19 20:10 josectobar

I am seeing this as well.

This is being caused by a few of our dependencies which don't support auto linking (they're linked manually).

rcidt avatar Oct 31 '19 16:10 rcidt

@josectobar Where are you adding that workaround? If I replace the error line in the OP with that, I just get new errors ('React/RCTAssert.h' file not found).

herstand avatar Nov 04 '19 17:11 herstand

Following. We are facingn the same issue
@josectobar

eyalabadi98 avatar Nov 07 '19 01:11 eyalabadi98

Ok, I managed to fix it (for me, at least). What you do is the following:

  1. Go to Project navigator > Libraries > RNFetchBlob.xcodeproj
  2. Click on Build Settings and then the first item under "Targets"
  3. Scroll down to 'Search Paths'
  4. Double click to edit the 'Header Search Paths'
  5. Add the following entry (click '+'): ${SRCROOT}/../../../ios/Pods/Headers. Make sure to set it to recursive.
  6. Clean (cmd + shift + K) and re-build (cmd + B)

Repeat for other libraries that complain about missing React/<whatever>.h files, perhaps with differing amounts of ../ before the ios/Pods/Headers/

infostreams avatar Nov 13 '19 11:11 infostreams

Ok, I managed to fix it (for me, at least). What you do is the following:

  1. Go to Project navigator > Libraries > RNFetchBlob.xcodeproj
  2. Click on Build Settings and then the first item under "Targets"
  3. Scroll down to 'Search Paths'
  4. Double click to edit the 'Header Search Paths'
  5. Add the following entry (click '+'): ${SRCROOT}/../../../ios/Pods/Headers. Make sure to set it to recursive.
  6. Clean (cmd + shift + K) and re-build (cmd + B)

Repeat for other libraries that complain about missing React/<whatever>.h files, perhaps with differing amounts of ../ before the ios/Pods/Headers/

To sum up, I'll update my workaround here: https://github.com/facebook/react-native/issues/26665#issuecomment-571082076

luatnd avatar Jan 03 '20 08:01 luatnd

Ok, I managed to fix it (for me, at least). What you do is the following:

  1. Go to Project navigator > Libraries > RNFetchBlob.xcodeproj
  2. Click on Build Settings and then the first item under "Targets"
  3. Scroll down to 'Search Paths'
  4. Double click to edit the 'Header Search Paths'
  5. Add the following entry (click '+'): ${SRCROOT}/../../../ios/Pods/Headers. Make sure to set it to recursive.
  6. Clean (cmd + shift + K) and re-build (cmd + B)

Repeat for other libraries that complain about missing React/<whatever>.h files, perhaps with differing amounts of ../ before the ios/Pods/Headers/

Did anyone got this error while trying this solution? Screen Shot 2020-03-28 at 12 44 14 PM

judygab avatar Mar 28 '20 16:03 judygab

I have the same issue. React-Native: 0.62.2 React: 16.11.0 rn-fetch-blob: 0.12.0

image

image

Recursive option was also set image

ram95krishh avatar May 08 '20 08:05 ram95krishh

Having the same issue with react-native-passcode-auth:

"react": "16.11.0",
"react-native": "0.62.2",
"react-native-passcode-auth": "^1.0.0",

joeyBerger avatar May 24 '20 18:05 joeyBerger

Hi @judygab, I tried your solution and got the errors you mentioned above too. Did you solve it already? If so, can you please tell me how? Thanks in advance.

ravinalamada avatar Jan 17 '23 13:01 ravinalamada

Any updates ?

gokugen avatar Apr 02 '23 17:04 gokugen

any updates ?

saeedtkh avatar May 06 '23 12:05 saeedtkh

After following the ${SRCROOT}/../../../ios/Pods/Headers I ran into another issue with duplicate symbols.

~~Anyone have any ideas how to fix this? 🤔~~ (Edit: fix is down below 👇🏾 )

❌  duplicate symbol '_OBJC_CLASS_$_RNFetchBlob' in
┌─ librn-fetch-blob.a(RNFetchBlob.o)
└─ libRNFetchBlob.a(RNFetchBlob-a70a61ec5fbdd003117a6dd9c81d14ef.o)

❌  duplicate symbol '_OBJC_METACLASS_$_RNFetchBlob' in
┌─ librn-fetch-blob.a(RNFetchBlob.o)
└─ libRNFetchBlob.a(RNFetchBlob-a70a61ec5fbdd003117a6dd9c81d14ef.o)

❌  ld: 73 duplicate symbols for architecture arm64

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

...

Edit (fix found 🚀 ): Here's the fix:

  1. removing libRNFetchBlob.a from Your_Project_Name > General > Frameworks, Libraries, and Embedded Content (assuming you following the manual linked guide like I did)
  2. adding the pod directly to my share extension in my Podfile:
target 'py_project-share-extension' do
  use_react_native!(
    :hermes_enabled => false,
    :flipper_configuration => flipper_config
  )

  pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
end
  1. run pod install from the ios folder 🤞🏾

The issue seemed to be that because I was already linking the pods directly (see pic below) I didn't need to manually add the libRNFetchBlob.a file. Here's what my final frameworks section looked like:

Screenshot 2023-05-29 at 11 14 51 PM

megancooper avatar May 30 '23 05:05 megancooper