Could any one tell me what's the wrong with this code? It raises the following error and cause application to crash:
reason: 'keypath Studies.patients.PatientName not found in entity <NSSQLEntity Studies id=3>'
Code:
- (void)viewDidLoad {
[super viewDidLoad];
test_coredataAppDelegate *appDelegate = (test_coredataAppDelegate *)[[UIApplication sharedApplication] delegate];
self.context = appDelegate.managedObjectContext;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Studies" inManagedObjectContext:_context];
[fetchRequest setEntity:entity];
/**/
NSLog(patientName);
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:
@"(Studies.patients.PatientName == %@ )",patientName]];
NSError *error;
self.StudiessList = [_context executeFetchRequest:fetchRequest error:&error];
self.title = @"patients";
[fetchRequest release];
}