Martin Konicek
Martin Konicek

Reputation: 40934

Adding React Native to an existing iOS app - fails to compile

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.

Upvotes: 1

Views: 493

Answers (1)

alloy
alloy

Reputation: 21048

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.

Upvotes: 1

Related Questions