React native base headers for ios not found

匿名 (未验证) 提交于 2019-12-03 02:56:01

问题:

During the iOS linking phase, I started seeing errors for my React Native project.

React Native version: 0.41.2, 0.40, 0.39

All worked fine, I edited the Android version, React Native code didn't change, when this kind of linking errors started showing up with headers on /node_modules/react-native/React/Base/{RCTHeaderName.h} path not being found:

In file included from /Users/user/ReactNativeProject/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:9: ../react-native/React/Base/RCTBridgeModule.h:12:9: fatal error: 'React/RCTDefines.h' file not found #import <React/RCTDefines.h>         ^ 
  • In the Link Binary With Libraries I include the core React library (libReact.a).

  • The location of the RCTLog.h is PROJECTROOT/node_modules/react-native/React/Base/RCTLog.h, but the import is #import <React/RCTLog.h>

  • Newly adding React.xcodeproj into Libraries doesn't help, Xcode's Product > Clean doesn't help, neither does restarting Xcode

  • react-native run-android works, react-native run-ios shows the error

  • File permissions set to the user executing react-native run-ios

回答1:

Do you have Parallelize build option unchecked and React listed first in your build targets?

You can find this window in Xcode => Your project icon near the run button => Edit scheme => Build tab



回答2:

Update: solution on Facebook React-Native https://github.com/facebook/react-native/issues/11813

============

This issue happened to me also. It seems React.xcodeproj only recognise configuration Debug and Release. All of output of React.xcodeproj is written into Debug-iphonesimulator or Release-iphonesimulator.

That means if you have some configurations other than "Debug/Release", the output will still be written into Debug-iphonesimulator or Release-iphonesimulator, that is not what we want.

So the solution is to add a same configuration in React.xcodeproj to match the one of your own project.

For example, if you have "Debug/Release/Test/AppStore" 4 configurations in your own project, you have to make sure React.xcodeproj also has the same 4 configurations.

please click the "+" button of Configurations, then "Duplicate Release Configuration", and rename it according to you need.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!