RCT Linking Manager file not found

2020-05-19 06:55发布

问题:

I want to use react native library RCTLinkingManager which shows up in menu under "Libraries > RCTLinkingManager.xcodeproj".

However when i add it to iOS/AppDelegate.m like so:

#import "RCTLinkingManager.h"

// @implementation ...

Build fails with 'RCTLinkingManager.h' file not found. I tried to clean the product and clean build with no luck.

回答1:

You have to add $(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS to your "Header Search Paths" in the Build Config of your project. You can find more info on the official React documentation



回答2:

If you are using React Native and the command line, Sébastien's modification proposal is to be made to ios/<yourproject>.xcodeproj/project.pbxproj by adding

"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",

to the HEADER_SEARCH_PATHS lists (4 locations)



回答3:

I had a similar issue only when I've done the archive/release version... that happen because the import was made under the #if DEBUG. So make sure you put the import in the proper place otherwise you can get Use of undeclared identifier 'RCTLinkingManager' error