从核心数据中获取实体:
VVdAppDelegate *delegate = (VVdAppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *managedObjectContext = [delegate managedObjectContext];
NSEntityDescription *entityDescriptionDelegate = [NSEntityDescription entityForName:@"entityName" inManagedObjectContext:managedObjectContext];
NSFetchRequest *requestData = [[NSFetchRequest alloc] init];
[requestData setEntity:entityDescriptionDelegate];
NSError *error;
如果有多个 NSManagedObject
NSArray *objectsArray = [managedObjectContext executeFetchRequest:requestData error:&error];
for (NSManagedObject *object in objectsArray) {
// Here update values of every object
}
// And save values to core data
[managedObjectContext save:&error];