Unknown command type when issuing a NSBatchDeleteRequest

Hi! I'm basically trying to delete all managed entitiy from a MOC using a NSBatchDeleteRequest. However when issuing the request i get the rather strange error:

Unknown command type <NSBatchDeleteRequest : resultType : 2, fetch :<NSFetchRequest: 0x100a304e0> (entity: Album; predicate: ((null)); sortDescriptors: ((null)); type: NSManagedObjectIDResultType; ) >

I'm running OSX 10.11.5


I'm using this simple code snippet here:

let moc = delegate.managedObjectContext
let deleteRequest = NSBatchDeleteRequest(fetchRequest: NSFetchRequest(entityName: "Album"))
deleteRequest.resultType = .resultTypeCount
     
do {
  try moc.execute(deleteRequest)
} catch let error as NSError {
  print(error)
}


Am I doing something fundamentally wrong here?

Ok nevermind... The Xcode generated Core Data code with NSXMLStoreType, which in fact does not seem to support Batch (Delete) Requests.

Unknown command type when issuing a NSBatchDeleteRequest
 
 
Q