Revision: 40420
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 1, 2011 23:20 by jodm
Initial Code
- (void) deleteAllObjects: (NSString *) entityDescription { NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:entityDescription inManagedObjectContext:_managedObjectContext]; [fetchRequest setEntity:entity]; NSError *error; NSArray *items = [_managedObjectContext executeFetchRequest:fetchRequest error:&error]; [fetchRequest release]; for (NSManagedObject *managedObject in items) { [_managedObjectContext deleteObject:managedObject]; NSLog(@"%@ object deleted",entityDescription); } if (![_managedObjectContext save:&error]) { NSLog(@"Error deleting %@ - error:%@",entityDescription,error); } }
Initial URL
Initial Description
Initial Title
Clear Core Data Table
Initial Tags
data
Initial Language
Objective C