Realm-js: Unable to build library for iOS

Created on 19 Sep 2017  路  6Comments  路  Source: realm/realm-js

Hello,

I want to build the library for iOS so that i can simply link it in XCode. I need to do this because we integrated React Native into an existing project using Cocoapods and I did not find any other way to integrate it.

I did the following steps from the readme:

Clone the repository:
git clone https://github.com/realm/realm-js.git

Update submodules:
git submodule update --init --recursive

Open react-native/ios/RealmReact.xcodeproj in Xcode 8.3.3
Select scheme "RealmReact" and there the target "RealmReact".

Build.

Expected result:
Xcode builds the realm library.

Actual result:
'RCTBridge+Private.h' file not found (RealmReact.mm:21:9).

Did I miss any steps?

O-Community T-Help

All 6 comments

That's not so much a realm issue as something that happens every time you touch a react native project.

Check the header search paths in the RealmReact target - All projects in your workspace need to find exactly one copy of the react native headers, and the relative paths used probably aren't correct if you don't have a default react native install.

Hello,

thanks for the explanation.

Yes, the relative paths in the header search paths do not match the installed react-native.

What do you mean by default react native install?
When I run "npm install react-native", it puts the header "RCTBridge+Private.h" into "node_modules/react-native/React/Base". Looks like the RealmReact Xcode project looks for the headers in "$(SRCROOT)/../../../react-native/React" which is not inside node_modules.

Is there a way to build RealmReact without manual modifications to the search paths?

The assumed structure would be to have both react-native and realm in the node_modules folder of your app - if you don't want to change the search path, just clone react-native next to your realm folder, making sure that the version there is exactly the same as the one in your app project.

That said, I'd recommend updating your app project to look something like the default react-native setup - it's mostly just a matter of dropping the relevant project files into Libraries.

Thanks, we solved it by putting react-native to the place where the XCode project is expecting it.

Another thing that can cause this is a Podfile entry that does not exist which prevents /ios/Pods/Headers/Public/React-Core/React/ from being installed.

Monitor output of pod install command to look for problems.

After I fixed my Podfile:
find . -name 'RCTBridge+Private.h' ./node_modules/react-native/React/Base/RCTBridge+Private.h ./ios/Pods/Headers/Public/React-Core/React/RCTBridge+Private.h ./ios/Pods/Headers/Private/React-Core/React/RCTBridge+Private.h

Thanks, we solved it by putting react-native to the place where the XCode project is expecting it.

Hello
What did you do exactly to run your project can you explain I have the same issue
"react/rctbridge+private.h' file not found" while building

react-native 0.60.4
realm 3.1.0

Was this page helpful?
0 / 5 - 0 ratings