Getting this error while building a react-native iOS app on xcode.
Started getting this error after npm install and rpm linking react-native-fs library. But
For me didn't work any from the above solutions and below it is what worked (I had already checked out Parallelize Build
and added React
)
1. Open XCode --> To Libraries add `$LibraryWhichDoesNotWork.xcodeproj$`
2. Then for your app in the `Build Phases` add to the `Link Binary with Libraries` the file `lib$LibraryWhichDoesNotWork$.a`
For me, this error occurred when I added a new scheme/target (app.staging) in the app and installed pods using pod install.
This issue is occurring due to pods are not shared for all targets. So I need to add newly added target (app.staging) inside the Podfile.
Here is my Podfile.
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'app' do
# Pods for app
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
target 'appTests' do
inherit! :search_paths
# Pods for testing
end
# Pods for staging app // important line below
target 'app.staging'
use_native_modules!
end
QUICK FIX (not the best)
Change the import react-native header lines:
#import <React/RCTBridgeModule.h>
#import <React/RCTLog.h>
To:
#import "RCTBridgeModule.h"
#import "RCTLog.h"
Here is an example of changes I had to make for the library I was trying to use: Closes #46 - 'RCTBridgeModule.h' file not found.
What you can do to get it right is:
1) npm uninstall reat-native-fs
to uninstall library
2)npm unlink react-native-fs
to unlink the library
Now the library is successfully removed and now install the lib again in your project and this time link everything manually. Sometime automatic linking causes this error.
If you want to make it from your editor also open SMobile.xcscheme
And change parallelizeBuildables = "NO"
I receive this error in any new module I create with create-react-native-module. None of the posted solutions worked for me.
What worked for me was first making sure to run yarn
in the newly created module folder in order to create node_modules/
(this step is probably obvious). Then, in XCode, select Product -> Scheme -> React instead of the default selection of MyModuleName.