Swift SourceKitService 崩溃 [英] Swift SourceKitService Crashed
问题描述
我有一个使用 Core Data 的 Swift 项目,并且为 saveContext()
生成的代码导致 Xcode 因 SourceKitService Crashed 错误而崩溃.当我将其注释掉时,错误停止,并且似乎是 self.managedObjectContext
导致了错误.我已经注释掉了我的代码,所以它就像一个新项目,但它仍然崩溃.谢谢
I have a Swift project using Core Data and the generated code for saveContext()
is causing Xcode to crash with the SourceKitService Crashed error. When I comment it out the error stops, and it seems to be self.managedObjectContext
which is causing the error. I have commented out my code so it is like a new project but its still crashing. Thanks
(Xcode 6.0.1)
(Xcode 6.0.1)
func saveContext () {
if let moc = self.managedObjectContext {
var error: NSError? = nil
if moc.hasChanges && !moc.save(&error) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error (error), (error!.userInfo)")
abort()
}
}
}
我创建了一个新项目并复制了我的代码,并且新项目很好(并且完全相同),因此我已将此作为潜在错误报告给苹果.
I made a new project and copied my code across, and the new project is fine (and exactly the same) so I have reported this to apple as a potential bug.
谢谢
更新:
发现这是为了让事情变得更容易:)
Found this to make things a little easier :)
https://github.com/kattrali/deriveddata-exterminator
推荐答案
我会在各种项目中工作并不断收到此错误,有时甚至导致 Xcode 无法使用.我最终通过退出 Xcode,清空 ~/Library/Developer/Xcode/DerivedData
文件夹,然后重新打开项目解决了这个问题.
I would work on various projects and continually get this error, sometimes to the point where Xcode became unusable. I eventually solved the problem by quitting Xcode, emptying out the ~/Library/Developer/Xcode/DerivedData
folder, and then reopening the project.
这篇关于Swift SourceKitService 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!