在我安装了Xcode7测试版并将我的快速代码转换成SWIFT 2之后,我遇到了一些我无法解决的代码问题.我知道SWIFT 2是新的,所以我搜索了一下,想既然没有关于它的任何东西,我应该写一个问题.
Here is the error:个
调用可以引发,但它没有标记为"try",错误也不是 已处理
Code:
func deleteAccountDetail(){
let entityDescription = NSEntityDescription.entityForName("AccountDetail", inManagedObjectContext: Context!)
let request = NSFetchRequest()
request.entity = entityDescription
//The Line Below is where i expect the error
let fetchedEntities = self.Context!.executeFetchRequest(request) as! [AccountDetail]
for entity in fetchedEntities {
self.Context!.deleteObject(entity)
}
do {
try self.Context!.save()
} catch _ {
}
}
Snapshot:个