ios Xcode 8.0 命令 /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc 失败,退出代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38764691/
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-08-31 09:51:02  来源:igfitidea点击:

Xcode 8.0 Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

iosxcodecompilationcompiler-errorsxcode4

提问by Fabrizio Bartolomucci

When I compile my code on Xcode Version 8.0 beta 4 (8S188o) I get this single error bringing the compilation to failure:

当我在 Xcode Version 8.0 beta 4 (8S188o) 上编译我的代码时,我收到了这个导致编译失败的错误:

Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

命令 /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc 失败,退出代码 1

I tried to clean the project and wipe the derived folder but that did not change things. What is it and how may I know more about it?

我尝试清理项目并擦除派生文件夹,但这并没有改变。它是什么,我如何才能了解更多?

When I try to compile on the terminal the error being reported is:

当我尝试在终端上编译时,报告的错误是:

Invalid bitcast\n %.asUnsubstituted = bitcast %swift.error* %13 to i2, !dbg !438\nLLVM ERROR: Broken function found, compilation aborted!\n

无效的 bitcast\n %.asUnpaid = bitcast %swift.error* %13 到 i2,!dbg !438\nLLVM 错误:发现损坏的函数,编译中止!\n

采纳答案by Fabrizio Bartolomucci

The problem went away by itself for mysterious reasons. Instead of the whimsical linking error I got a new bunch of errors due to Swift 3 fling which the app compiles and run fine.

由于神秘的原因,问题自行消失了。由于应用程序编译并运行良好的 Swift 3 fling,我得到了一堆新的错误,而不是异想天开的链接错误。

回答by Adam Bardon

Happened to me, when I had two classes with the same name in my project. After deleting the redundant one, error disappeared.

发生在我身上,当我的项目中有两个同名的类时。删除多余的后,错误消失了。

回答by Giggs

If you look above the error, Xcode will tell you which ViewController is added/declared twice, navigate to it and remove the reference. Build and you're good to go.

如果您查看错误上方,Xcode 会告诉您哪个 ViewController 被添加/声明了两次,导航到它并删除引用。构建,你就可以开始了。

回答by Naveed Ahmad

I am going to tell you my silly mistake, the error is showing the issueand It took 3 hours to me to understand. look into below error

我要告诉你我的愚蠢错误错误显示了问题,我花了 3 个小时才理解。查看以下错误

enter image description here

在此处输入图片说明

look into above 2 lines of error, the problem is shown, Obviously, In my case Xcode is complaining that Location.swift and Customer.swiftfile is missing, look into my project hierarchy, the same issue can understand.

查看以上 2 行错误,显示了问题,显然,在我的情况下,Xcode 抱怨 Location.swift 和 Customer.swift文件丢失,查看我的项目层次结构,可以理解相同的问题。

It's my advice to everyone that first understand the error and then look into issues. I removed my desktop files, which were referenced in the project, and therefore compile error occurred.

这是我对每个人的建议,首先要了解错误,然后再调查问题。我删除了我在项目中引用的桌面文件,因此发生了编译错误。

enter image description here

在此处输入图片说明

回答by Jeylani Osman

Clean your project that fixed my project Product/clean

清理修复了我的项目的项目 Product/clean

回答by Shyam

I got this error for core data models that i've created manually.And it got resolved by changing particular entity's 'Codegen' attribute to 'Manual/None' under Data Model Inspector.

对于我手动创建的核心数据模型,我收到了这个错误。它通过在数据模型检查器下将特定实体的“Codegen”属性更改为“Manual/None”来解决。

回答by Md Imran Choudhury

If you change any file folder location or change any Objective-C Bridging file path. Then it's happened some time.

如果您更改任何文件夹位置或更改任何 Objective-C 桥接文件路径。然后它发生了一段时间。

  1. Update your Bridging path.
  2. Clean your project alt+ Shift+ Command+ K
  3. Quit Xcode completely Command+ Q
  4. Open project again and wait for Xcode to index files.
  1. 更新您的桥接路径。
  2. 清理你的项目alt+ Shift+ Command+K
  3. 完全退出 Xcode Command+Q
  4. 再次打开项目并等待 Xcode 索引文件。

enter image description here

在此处输入图片说明

回答by itsmcgh

I got this error when I was trying to run an xcode project. A swift file wasn't being found and complied correctly, even though clearly in the xcode project file you can see the swift file and when you click on it in finder the file comes up as a separate xcode swift file. I solved this by:

我在尝试运行 xcode 项目时遇到此错误。没有找到并正确编译 swift 文件,即使在 xcode 项目文件中您可以清楚地看到 swift 文件,并且当您在 finder 中单击它时,该文件会作为单独的 xcode swift 文件出现。我通过以下方式解决了这个问题:

  • Deleting the problematic swift file
  • Creating a new swift file with the same name
  • Xcode prompts that the file is already created, press replace
  • copy/replace the code/etc. in the file
  • Clean the project (for good measure)
  • Run the project
  • 删除有问题的 swift 文件
  • 新建一个同名的 swift 文件
  • Xcode提示文件已经创建,按replace
  • 复制/替换代码/等。在文件中
  • 清理项目(为了好的措施)
  • 运行项目

回答by Mohammed Rizwan N

I got this error and resolved by changing Xcode command line tools,

我收到此错误并通过更改 Xcode 命令行工具解决,

Goto Xcode -> Preferences -> Choose Locations tab

转到 Xcode -> 首选项 -> 选择位置选项卡

Choose required Command Line Tools from drop down, run the project error has been fixed.

从下拉列表中选择所需的命令行工具,运行项目错误已修复。

回答by PlateReverb

The solution that worked for me is I had to delete the .xcdatamodeldfile in my project and create a new one. This solved it.

对我有用的解决方案是我必须删除.xcdatamodeld项目中的文件并创建一个新文件。这解决了它。