Swift SourceKitService崩溃 [英] Swift SourceKitService Crashed
问题描述
我有一个Swift项目使用Core Data和生成的代码 saveContext()
导致Xcode崩溃与SourceKitService崩溃的错误。当我评论它的错误停止,似乎是 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屋!