React Native is always painful to use 3rd party libraries with native code.
One of the issues we often face is React/RCT*.h file not found.
Specific case we are going to inspect today is when using outdated 3rdparty package which is not providing autolinking.
Projects for iOS that does not provides autolinking means the project does not have podspec file.
In this case, if the iOS XCode project used React/RCT*.h header file, it will spit out the file not found error.
There are 2 solutions:
- Suggest / Ask plugin maintainer to add podspec file and update the plugin. (We have to wait and no one knows when he/she will do).
- Manually add header search path in the XCode project.
First solution is just throw ball to original guy, needs to wait.
But what if the project is urgent and can not wait?
In order to manually add header search path, First make sure you manually called link command: npx react-native link PACKAGE_NAME
This will add the project as library to the XCode workspace and can be found under Libraries.
Select all the plugin projects, Go to “Build Settings” / “Search Paths” / “Header Search Paths”
Then add “$(SRCROOT)/../../../ios/Pods/Headers/Public”
(Exact number of ../ will vary per project and libraries, so make sure you give correct path).
Then you will see all those chains of file not found will be fixed at once.