I currently have two entities called as Person and Rem.
Person entity has a relationship called theRem with Rem and Person is a parent Event.
Rem entity has a attribute called Date which i need to retrieve using the Person entity,how do i do this?
here is my code:
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSManagedObjectContext *managedObjectContext=[appDelegate managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"Date" ascending:YES];
[fetchRequest setSortDescriptors:@[sortDescriptor]];
//Fetch from core data in background thread
NSError *error;
allArray = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
i know the above code doesnt work,but somewhere in the apple documentation i read i could try something like this
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"theRem.Rem" ascending:YES];
can anyone help me out? Thanks