I have a set of core data with entity called PeronalInfo with attributes name, age gender, and nationality.
E.g.
John, 25, Male, English
Sean, 65, Male, Indian
Jess, 46, Female, American
I need to store this core data as an array so I can do a check for anyone age over 30 and display all the attributes.
I have this so far:
- (NSManagedObjectContext *)managedObjectContext
{
NSManagedObjectContext *context = nil;
id delegate = [[UIApplication sharedApplication] delegate];
if ([delegate performSelector:@selector(managedObjectContext)]) {
context = [delegate managedObjectContext];
}
return context;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self preparePersonalInfo];
}
-(void)preparePersonalInfo
{
// Fetch the devices from persistent data store
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"PersonalInfo"];
personalInfo = [[managedObjectContext executeFetchRequest:fetchRequest error:nil] mutableCopy];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *personalInfoArray = [[NSMutableArray alloc] init];
personalInfoArray = //This is where I need help to add the core data into this array
//then I need to check if age is over 30
//Then store the whole row of data as an array of an array to display it later
}
How do I do the commented section.
Thanks in advance!