I have one entity named Register
with several attributes. I want to delete all the data from the specific entity.
Please give me an answer related to iOS Swift.
I have one entity named Register
with several attributes. I want to delete all the data from the specific entity.
Please give me an answer related to iOS Swift.
I've also searched the same and found some like below. Using a Fetch Request to Collect all objects and delete one by one.
var arr: [AnyObject] = managedObjContextIns.executeFetchRequest(fetchReq, error: &error)
for managedObj: NSManagedObject in arr
{
managedObjContextIns.deleteObject(managedObj)
}
var error: NSErrorPointer? = nil
managedObjContextIns.save(&error)
Hope it helps.