Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode build fails when importing React after fresh integration #18205

Closed
steven-diaz opened this issue Mar 5, 2018 · 7 comments
Closed

Xcode build fails when importing React after fresh integration #18205

steven-diaz opened this issue Mar 5, 2018 · 7 comments
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@steven-diaz
Copy link

Followed the Integrate with Existing Apps guide.

After dealing with issues #17764 & #16039, the project finally compiled with no errors. Then, simply import React in a swift source file and building results in the following error.

screen shot 2018-03-05 at 3 52 43 pm

Environment

Environment:
OS: macOS High Sierra 10.13.2
Node: 9.7.1
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: ^0.54.0 => 0.54.0

Expected Behavior

No build errors when importing React

Actual Behavior

Build error on importing React

Steps to Reproduce

  • yarn add react-native
  • Address #17764 with yoga.podspec changes: spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h'
  • pod install
  • Address #16039 by changing import to <React/fishhook.h>
  • Build successfully
  • import React
  • Build error
@carrchr
Copy link

carrchr commented Mar 6, 2018

I have an almost identical setup (Node: 9.5.0 and macOS 10.12.6) and a shell script that patches the podspecs. Rolling back to react-native 0.53.3 works as expected.

@Plo4ox
Copy link

Plo4ox commented Mar 10, 2018

@carrchr It is cool if it still work in 0.53.3 (I didn't took the time to re-test it ^^) but as I said in my issue, It is always better to be able to have the latest version of a framework with its latest features :)
@steven-diaz Thanks for reporting the issue. After reproducing your issue, I really think that React-Native developers seem to use obj-C++ but that is not the right thing to do if they want iOS developer to be able to use their framework easily.
As Apple say here:
You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code.
and in your case it is what happens.
They are passing references by doing CGSize &minimumSize, which is working in ObjC++ but not in Objc, instead of CGSize * minimumSize
I don't know what to do. I don't think that creating a huge patch is the best solution but, well that's what I'm doing for now :)

@studyro
Copy link

studyro commented Mar 21, 2018

I'm seeing this issue too.

So projects that use Swift can't compile with React Native 0.54+ ? It's 😢.

@inDream
Copy link

inDream commented Mar 22, 2018

@studyro You could follow this fix: facebook/yoga#711 (comment)

@studyro
Copy link

studyro commented Mar 23, 2018

@inDream Thanks, didn't be aware of post-install hacks. Running good now.

@lucaslz2020
Copy link

lucaslz2020 commented May 10, 2018

Same issue.

in Swift

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

@facebook facebook locked as resolved and limited conversation to collaborators Jun 12, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants