title: Error with Core Data Fetch request 'NSFetchRequest could not locate an NSEntityDescription'
body: <p>I've been having trouble instigating a fetch request over the past few days. Every time I try to launch the view, it crashes with this error:</p>
  
  <blockquote>
    <p>"Terminating app due to uncaught exception
    'NSInternalInconsistencyException', reason:     'NSFetchRequest could
    not locate an NSEntityDescription for entity name 'VoiceNotes''"</p>
  </blockquote>
  
  <p>I use the exact same code (except with a different entity name) on another view, and it works flawlessly. There's nothing wrong with the entity name, it's the same name that the entity has in the data model.</p>
  
  <p>Would someone please be able to help me out?</p>
  
  <p>Thanks in advance!</p>
  
  <p>This is the code for the fetch method:</p>
  
  <pre><code>- (void)setupFetchedResultsController
  {
  if (!self.managedObjectContext) {
      id delegate = [[UIApplication sharedApplication] delegate];
      self.managedObjectContext = [delegate managedObjectContext];
  }
  NSString *entityName = @"VoiceNotes";// Put your entity name here
  NSLog(@"Setting up a Fetched Results Controller for the Entity named %@", entityName);
  
  // Request
  NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:entityName];
  
  NSLog(@"test after request");
  
  //request.predicate = [NSPredicate predicateWithFormat:@"Role.name = Blah"];
  
  // Sorting
  request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"toInfo.title"
                                                                                   ascending:YES
                                                                                    selector:@selector(localizedCaseInsensitiveCompare:)]];
  // Fetch
  NSLog(@"test after request THE SECOND");
  self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
                                                                      managedObjectContext:self.managedObjectContext
                                                                        sectionNameKeyPath:nil
                                                                                 cacheName:nil];
  NSLog(@"test after request THE THIRD");
  [self performFetch];
  }
  </code></pre>
  
  <p><strong>Edit:</strong>
  I have three entities in my data model, one which is unrelated to this problem, and two which have a relationship running between them. These are called VoiceNotes and VoiceNotesInfo.</p>
  
  <p>Screenshot of the Core Data Model:
  <img src="https://i.stack.imgur.com/js1vY.png" alt="enter image description here"></p>