1. 程式人生 > >編譯依賴於React Native0.46.4的React Native IOS工程時,出現錯誤“fatal error: 'React/RCTEventEmitter.h' file not found”

編譯依賴於React Native0.46.4的React Native IOS工程時,出現錯誤“fatal error: 'React/RCTEventEmitter.h' file not found”

問題 clear solution str ack fat navi parallel avi

我的環境:

WebStorm 2017.2
Build #WS-172.3317.70, built on July 14, 2017

JRE: 1.8.0_152-release-915-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Mac OS X 10.12.6

Xcode8.3.3(8E3004b)

網上搜索,可以解決我的問題的網址:https://stackoverflow.com/questions/41663002/react-rctbridgemodule-h-file-not-found

搬運如下:

In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOs (solution was found here: https://github.com/facebook/react-native/issues/11721#issuecomment-270672904).

What happened was that xCode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.

The solution in my case was to:

  1. Disable the parallel builds:

    • xCode menu -> Product -> Scheme -> Manage Shemes...
    • Double click on your application
    • Build tab -> clear the tick on Pallelize Build
  2. Add react as a project dependecy

    • xCode Project Navigator -> drag React.xcodeproj from Libraries to root tree
    • Build Phases Tab -> Target Dependencies -> + -> add React

編譯依賴於React Native0.46.4的React Native IOS工程時,出現錯誤“fatal error: 'React/RCTEventEmitter.h' file not found”