我有一个使用Core Data的Swift项目,生成的代码saveContext()导致Xcode因SourceKitService Crashed错误而崩溃.当我评论它时,错误停止,似乎self.managedObjectContext是导致错误.我已经注释掉了我的代码,所以它就像一个新项目,但它仍然崩溃.谢谢
(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()
}
}
}
Run Code Online (Sandbox Code Playgroud)
我创建了一个新项目并复制了我的代码,新项目很好(并且完全一样),所以我向苹果公司报告这是一个潜在的错误.
谢谢
更新: …