我在Xcode中遇到了一个问题,错误“源套件服务终止”正在弹出,所有语法高亮显示和代码完成都在Swift中消失了。我该如何解决这个问题?

下面是一个示例图像:


当前回答

在我的spritekit项目中插入touchesMoved-function后,这种情况开始发生。这个函数使用强制展开,这似乎导致了问题:

override func touchesMoved(touches: NSSet!, withEvent event: UIEvent!)

在删除感叹号并停止强制打开后,SourceKitService停止了崩溃。

希望这能有所帮助!

其他回答

我在苹果的开发者论坛上找到了一个解决方案(需要登录,所以我也会在这里解释)。

TLDR:不要在Objective-C中导入与@interface同名的@protocol到Swift桥接头。例如,Facebook SDK有一个名为“FBGraphObject”的协议和接口。

以下是论坛帖子:

Adding Facebook SDK causes SourceKitService to crash. If you want to use beta 3 and you need Facebook SDK, one work around that I found and is working for me is refactoring Facebook SDK's @protocol FBGraphObject and renaming it to something like @protocol FBGraphObjectProtocol as an @interface FBGraphObject also exists and apparently SourceKit doesn't like it. It sure is a temporary solution just to keep you functional and you'll have to use Cocoapods or otherwise build Facebook SDK yourself rather than using the framework library. For the time being, you'll need to make sure you don't have conflicting @protocol and @interface declarations and that includes 3rd party libraries you may be using. This cost me today, hope it helps! Posted by e.parto on July 10, 2014

在我的spritekit项目中插入touchesMoved-function后,这种情况开始发生。这个函数使用强制展开,这似乎导致了问题:

override func touchesMoved(touches: NSSet!, withEvent event: UIEvent!)

在删除感叹号并停止强制打开后,SourceKitService停止了崩溃。

希望这能有所帮助!

在xcode中,转到你的菜单栏>>窗口>> devices (shift+cmd+2),一个新的窗口将弹出,并在左下角,添加一个新的模拟器,特别是一个运行在iOS 8.0上的现有列表 编辑:你可能需要重新启动xcode

具有:http://www.reddit.com/r/swift/comments/2bznfo/error_running_playground_unable_to_find_suitable/

在项目中使用Swift以外的其他名称。“Swift”是保留的。

到目前为止,对我来说最常见的两个原因是:

行末的分号 导入文件中未引用的框架