Xcode 不显示编译错误

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

Xcode not displaying compile errors

swiftxcodeswift3compiler-errorsxcode8

提问by ajith Kumark

I'm working in a specific Xcode project and deliberatly making errors in my code (like using undeclaredvariables), but Xcode doesnt seem to show any compile errors in my code.

我在一个特定的 Xcode 项目中工作并故意在我的代码中出错(比如使用未声明的变量),但 Xcode 似乎没有在我的代码中显示任何编译错误。

  • It shows errors only when its build or clean.

  • Tried clean and build, cleaning derived data and restarted both Xcode and system, none of it works.

  • Using Xcode 8.2.1 (8C1002) and Swift 3

  • 它仅在构建或清理时显示错误。

  • 尝试清理和构建,清理派生数据并重新启动 Xcode 和系统,但都不起作用。

  • 使用 Xcode 8.2.1 (8C1002) 和 Swift 3

回答by Paulo Mattos

Besides the DerivedDatafolder, also try cleaning Xcode cachescompletely:

除了DerivedData文件夹之外,还可以尝试彻底清理 Xcode缓存

rm -rf $HOME/Library/Caches/com.apple.dt.Xcode/

I would recommend also killing the SourceKitprocess — always a source of issues these days! — but since you are already did a full reboot, so looks like you are good there.

我还建议终止这个SourceKit过程——这些天总是一个问题的根源!- 但是由于您已经完全重新启动,所以看起来您在那里很好。

If everything fails, you might consider upgrading to the latest Xcode, version 8.3. Just be aware that:

如果一切都失败了,您可以考虑升级到最新的 Xcode 8.3 版。请注意:

Xcode 8.3 no longer supports Swift 2.3. Please migrate your projects containing Swift 2.3 code to Swift 3 syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.

Xcode 8.3 不再支持 Swift 2.3。请通过打开项目并选择“编辑”>“转换”>“到当前 Swift 语法”将包含 Swift 2.3 代码的项目迁移到 Swift 3 语法。

回答by Paul

Project Settings, "Show all issues" fixed it for me.

项目设置,“显示所有问题”为我修复了它。