What I have found in most of the solution for deleting all entries from core data, is three step process:
Fetch them all
Delete them all
Save them all
Is there any alternative ...?
What I have found in most of the solution for deleting all entries from core data, is three step process:
Fetch them all
Delete them all
Save them all
Is there any alternative ...?
NSFetchRequest *requestDelete = [[NSFetchRequest alloc] initWithEntityName:@"Car"];
NSBatchDeleteRequest *deleteEntity = [[NSBatchDeleteRequest alloc] initWithFetchRequest:requestDelete];
NSError *deleteError = nil;
[myPersistentStoreCoordinator executeRequest:deleteEntity withContext:myContext error:&deleteError];
iOS 9 added a new class called NSBatchDeleteRequest that allows you to easily delete objects matching a predicate without having to load them all in to memory.