title: how to fetch data from two tables in core data objective-c
body: <p>I'm new in use Core Data. I have a two entities CDContact and CDAddress. I have problem to fetch a second entity (CDAddress).</p>
  
  <pre><code>self.fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"CDContact"];
  [self.fetchRequest setSortDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"firstName" ascending:YES]]];
  self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:self.fetchRequest managedObjectContext:[CoreDataManager sharedInstance].managedObjectContext sectionNameKeyPath:nil cacheName:nil];
  
  [self.fetchedResultsController setDelegate:self];
  [self fetchResults];
  </code></pre>
  
  <p>It works but I get only data from CDContact.</p>
  
  <p>I try something like this (I found this on documentation):</p>
  
  <pre><code>NSManagedObjectContext *context = [CoreDataManager sharedInstance].managedObjectContext;
  NSEntityDescription *contactEntity = [NSEntityDescription entityForName:@"CDContact" inManagedObjectContext:context];
  NSFetchRequest *request = [[NSFetchRequest alloc] init];
  request.entity = contactEntity;
  request.relationshipKeyPathsForPrefetching = [NSArray arrayWithObject:@"CDAddress"];
  </code></pre>
  
  <p>but in this version both entities doesn't work.</p>
  
  <p>I'll be glad for any examples which help me resolve this problem.</p>