我在尝试执行批量删除时失败了,我无法弄清楚发生了什么。
我致电请求:
self.deleteAllRecords(entity: self.someEntity)
,功能是:
func deleteAllRecords( entity : String)
{
let delegate = UIApplication.shared.delegate as! AppDelegate
let context = delegate.persistentContainer.viewContext
let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: entity)
let request = NSBatchDeleteRequest(fetchRequest: fetch)
do {
let result = try context.execute(request)
print("result: ", result)
}
catch {
print ("There was an error 1")
}
do {
try context.save()
} catch {
print ("There was an error 2")
}
}
我因错误而挂断了。感谢任何帮助。
答案 0 :(得分:1)
Seam3目前不支持vm.temp
操作,因此会引发NSBatchDeleteRequest
错误。