在 xcode 更新到 8.0 后,React Native run-ios 构建失败。

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39560610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:16:23  来源:igfitidea点击:

React Native run-ios build fail after xcode update to 8.0.

xcodereact-nativexcode8

提问by Jophy Johnson

Okay so I've been working on this React Native project for a few weeks now without any issue. I recently updated to xCode 8.0 and RN build is failing. When I do "react-native run-ios", it returns a "BUILD FAILED" error. I tried it through xCode and it returns something similar. I tried looking around but I can't seem to find a solution to this. I'm sure it's probably some setting that changed within xcode that's messing it all up.

好的,我已经在这个 React Native 项目上工作了几个星期,没有任何问题。我最近更新到 xCode 8.0 并且 RN 构建失败。当我执行“react-native run-ios”时,它返回“BUILD FAILED”错误。我通过 xCode 尝试过它,它返回类似的东西。我试着环顾四周,但似乎找不到解决方案。我敢肯定,这可能是 xcode 中的某些设置发生了变化,这将一切搞砸了。

Running through terminal

通过终端运行

>     ** BUILD FAILED **
> 
> 
> The following build commands failed:  CompileC
> /Users/macuser/Documents/FreeLance/theHaps/DaHAPS/ReactApp/ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/Objects-normal/x86_64/RCTSRWebSocket.o
> RCTSRWebSocket.m normal x86_64 objective-c
> com.apple.compilers.llvm.clang.1_0.compiler (1 failure)
> /Users/macuser/Documents/FreeLance/theHaps/DaHAPS/ReactApp/node_modules/promise/lib/done.js:10
>       throw err;
>       ^
> 
> Error: xcodebuild process exited with code 65
>     at ChildProcess.<anonymous> (runIOS.js:102:14)
>     at emitTwo (events.js:100:13)
>     at ChildProcess.emit (events.js:185:7)
>     at maybeClose (internal/child_process.js:850:16)
>     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

Running through xcode:

通过 xcode 运行:

Xcode Error Screenshot

Xcode 错误截图

Thank you!

谢谢!

回答by Jophy Johnson

Step 1:

第1步:

  • go into your RN project folder and open ios > .xcodeproj
  • this will open the project in xcode.
  • 进入您的 RN 项目文件夹并打开 ios > .xcodeproj
  • 这将在 xcode 中打开项目。

Step 2:

第2步:

  • Run the file and once the build fails, it'll show errors on the left side. Double click "RCTWebSocket" and it'll open up a new window/tab with more settings.
  • 运行文件,一旦构建失败,它会在左侧显示错误。双击“RCTWebSocket”,它将打开一个包含更多设置的新窗口/选项卡。

Picture of settings

设置图片

Step 3:

第 3 步:

  • find "Apple LLVM 8.0 - Custom Compiler Flags"
  • under it you'll see "other warning flags" - there should be two flags in there right now. click and delete both the flags.
  • 找到“Apple LLVM 8.0 - 自定义编译器标志”
  • 在它下面你会看到“其他警告标志”——现在应该有两个标志。单击并删除两个标志。

Clean & Rerun your project and it should work like normal.

清理并重新运行您的项目,它应该可以正常工作。

回答by octohedron

You need to remove the custom compiler flags of -Werrorand -Walland clean (SHIFT + CMD + K)

您需要删除的自定义编译器标志-Werror-Wall清洁 (SHIFT + CMD + K)

回答by Enamul Hassan

Answer from the OP of this question:

来自这个问题的 OP 的回答

Now i have a solution to fix this
Select RCTWebSockettarget in XCode and remove flagin build setting > custom compiler flagthen build and run again!

现在我有一个解决方案来解决这个
选择RCTWebSocket目标Xcode和删除flagbuild setting > custom compiler flag随后的构建,并再次运行!

Note: This answer is posted as an edit of the question described above. I just edited the question and created an answer on behalf of the OP and made it community wiki so that no credit goes to me. But now, that question is merged with this question and the answer moved here. I do not know anything about the context of these two questions. I just got that in review queue.

注意:此答案发布为对上述问题的编辑。我刚刚编辑了这个问题,并代表 OP 创建了一个答案,并将其设为社区 wiki,这样我就不会有任何功劳了。但是现在,这个问题与这个问题合并,答案移到这里。我对这两个问题的上下文一无所知。我刚刚在审核队列中看到了它。