1

I followed the official guide on adding React Native to existing iOS apps (Swift).

pod install finished successfully and I got to the point when I import React in a Swift file and try to compile the app.

The build fails with an error in the yoga dependency. Xcode cannot find the C++ standard library:

enter image description here

However, then I click "Go to definition" on <algorithm>, Xcode can find it:

enter image description here

These are my project settings (I tried a few different combinations):

enter image description here

I'm fairly new to iOS development, so this might be a simple issue with our existing project, Xcode, Command Line Tools, or my machine. I Googled around a bit, no luck so far.

Any help from someone familiar with iOS development is appreciated! When we find the solution I'd like to update the official guide so others don't get stuck adding React Native to their app.

1 Answer 1

1

I believe your issue is fixed by this PR https://github.com/facebook/react-native/pull/17764, which reduces the number of exported Yoga headers to those that are actually needed to be able to build and as part of that removes headers that require C++ and its stdlib.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you Eloy! Just curious - any ideas why Xcode can't find the stlib and compile the code even when too many headers are exported?
I suspect that you are not adding the compiler options to the right target, but that’s hard to say without seeing the full compiler output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.