I'm getting a failure trying to perform a batch delete, and I cannot figure what is happening.
I call the request:
self.deleteAllRecords(entity: self.someEntity)
and the function is:
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")
}
}
I'm getting hung up at error 1. What can I try to resolve this?
Seam3 does not currently support the NSBatchDeleteRequest
operation, so an invalidOperation
error is thrown.