简体   繁体   English

编译swift源文件卡住了

[英]Compiling swift source files stuck

I have been working on my project when suddenly I have not compiled anymore, it stays waiting in Compile swift source files ... I cleaned the project, the folder, deleted the app and nothing. 我一直在研究我的项目突然间我还没有编译,它在编译swift源文件中等待...我清理了项目,文件夹,删除了应用程序,什么都没有。 Is there any way to know what is happening? 有什么办法可以知道发生了什么吗?

Is there any way to know what is happening? 有什么办法可以知道发生了什么吗?

Yes. 是。 Go into the Report Navigator which is the one selected by the little speech bubble at the top right of the navigator pane. 进入报告导航器 ,该导航器是导航器窗格右上角的小气泡所选择的导航器。 It will give you a list of all the actions you have performed like builds and tests and runs. 它将为您提供已执行的所有操作的列表,如构建,测试和运行。 The current build will be at the top of the pane. 当前版本将位于窗格的顶部。 Click on it. 点击它。

In the main editor you will see some buttons at the top and maybe some messages. 在主编辑器中,您将看到顶部的一些按钮,可能还有一些消息。 Click the All Messages button and it will show you a tree view of the current build. 单击All Messages按钮,它将显示当前构建的树视图。 The bottom line will be what the build system is doing now. 底线将是构建系统现在正在做的事情。 If it is not changing (ie new lines appearing) the build is stuck. 如果它没有改变(即出现新线条),则构建卡住。

Almost certainly the bottom line will be something like Compile SomeFile.swift . 几乎可以肯定,底线将是Compile SomeFile.swift Assuming it is, you can now triage the problem. 假设是,您现在可以对问题进行分类。 The Swift compiler usually gets stuck on inferring types for complicated expressions. Swift编译器通常会卡在复杂表达式的推断类型上。 The way to triage this is to comment out the entire file and then add lines back until the problem reappears. 对此进行分类的方法是注释掉整个文件,然后再添加行,直到问题再次出现。 Make sure that you always add enough back so that the file compiles without error. 确保始终添加足够的内容,以便文件编译时没有错误。

Obviously, the last line you added back will be the one causing the problem. 显然,您添加的最后一行将是导致问题的那一行。 Usually it's an expression that concatenates strings together with non strings that causes the problem. 通常它是一个表达式,它将字符串与非字符串连接起来,导致问题。

The problem is in dictionary [String:Any] when I change the dictionary to [String:String] the problem is resolved . 问题是在字典[String:Any]中,当我将字典更改为[String:String]时问题得到解决。 Is very strange.. 很奇怪..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM