简体   繁体   English

构建后,XCode Swift自动完成功能会中断

[英]XCode Swift autocomplete breaks down after build

I've got a project that started out two years ago as Obj-C, but recently has had a number of Swift 2.0 additions. 我有一个项目,两年前开始作为Obj-C,但最近有一些Swift 2.0的添加。 Right now the ratio is about 75%/25% in favor of Obj-C, but growing towards Swift. 现在这个比例大约是75%/ 25%,有利于Obj-C,但是向Swift增长。

Common with older projects, right? 与旧项目相同,对吧? Here's the problem: ever since XCode 7.3 I can't get code completion to work properly in Swift. 这就是问题:自从XCode 7.3以来,我无法在Swift中正常运行代码。

I take these steps: 我采取以下步骤:

  • Close Xcode 关闭Xcode
  • Terminal -> rm -rf ~/Library/Developer/Xcode/DerivedData/* 终端 - > rm -rf~ / Library / Developer / Xcode / DerivedData / *
  • Terminal -> rm -rf ~/Library/Caches/com.apple.dt.Xcode 终端 - > rm -rf~ / Library / Caches / com.apple.dt.Xcode

and all is good. 一切都很好。 But as soon as I do a full build of the XCode project, the problem's back and Swift doesn't code-complete until I remove the derived data again (either manually or through XCode), and re-index all the files. 但是一旦我完成了XCode项目的完整构建,问题就会出现问题,并且在我再次删除派生数据(手动或通过XCode)并重新索引所有文件之前,Swift不会完成代码。

Objective-C does complete, and the default and manually created macros also still work. Objective-C确实完成了,默认和手动创建的宏也仍然有效。 It's just the indexing that seems to break. 这只是索引似乎打破了。

Please, has anyone heard of this behaviour and know a fix for it? 请问,有没有人听说过这种行为,并知道修复它? It's great Swift training to have to type everything manually, but some of my methods have multiple block-parameters and it becomes a pain to write them out. 这是一个伟大的Swift培训,必须手动输入所有内容,但我的一些方法有多个块参数,写出来很麻烦。

If it matters at all, I've been using Swift 2.0 up to 2.2 syntax in the newer classes. 如果它很重要,我在新的类中一直使用Swift 2.0 2.2语法。

have you checked your deployment target? 你检查过部署目标了吗? i find out it it always works on 10.12 : 我发现它始终适用于10.12 在此输入图像描述

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

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