【发布时间】:2014-12-01 13:14:12
【问题描述】:
我有一个使用 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()
}
}
}
我创建了一个新项目并复制了我的代码,并且新项目很好(并且完全相同),因此我已将此作为潜在错误报告给苹果。
谢谢
更新:
发现这是为了让事情变得更容易:)
【问题讨论】:
-
这是一个 xcode 错误。您应该向 Apple 报告
-
你能把整个代码贴在这里吗?
-
升级到 Xcode 6.1 测试版。这解决了它。
标签: ios core-data swift crash xcode6