title: Reload Entire Core Data Object Rather than Add Specific Data
body: <p>I am very new to iOS. I am completely new to Core Data. I am taking over the code base of a project from my professor's former grad students. </p>
  
  <p>When my app fetches an image from its database, the path to the img is this:</p>
  
  <pre><code>/Users/matt/Library/Developer/CoreSimulator/Devices/DA58E774-84BE-48F6-B50F-5921F682E87B/data/Containers/Bundle/Application/DA30DEFB-D90B-4D52-8462-3F8A5F4C55ED/Leaflet-US.app/thumbnail/species/Abies fraseri/images/LTV-BAM-2848_crop.jpg
  </code></pre>
  
  <p>Because <code>CoreSimulator/Devices</code> is included in the path, I assume it looks for the image in the app's Core Data. I could be mistake, so please correct me if I'm wrong.</p>
  
  <p>I also have a version of thumbnail in my app's Resources file, which you can see does contain the <code>Abies fraseri</code> directory. </p>
  
  <p><a href="https://i.stack.imgur.com/ecM2e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ecM2e.png" alt="enter image description here"></a></p>
  
  <p>Right now, the Core Data does not have the <code>Abies fraseri</code> directory. I know this because in terminal I can <code>cd</code> into <code>/Users/matt/Library/Developer/CoreSimulator/Devices/DA58E774-84BE-48F6-B50F-5921F682E87B/data/Containers/Bundle/Application/DA30DEFB-D90B-4D52-8462-3F8A5F4C55ED/Leaflet-US.app/thumbnail/species/</code> and verify that <code>Abies fraseri</code> does not exist. I would like to update the core data's version of <code>thumbnail/species</code> so that it has it.</p>
  
  <p>From what I've <a href="https://stackoverflow.com/questions/41040253/how-to-use-coredata-in-xcode-8-with-objective-c">seen</a> <a href="https://stackoverflow.com/questions/19053117/how-to-update-core-data-entered-values">in</a> these posts, you update an object of core data by adding specific key/value pair to the array that results from a fetch. </p>
  
  <p>Example:</p>
  
  <pre><code>NSManagedObject *entityNameObj = [NSEntityDescription insertNewObjectForEntityForName:@"EntityName" inManagedObjectContext:context];
  [entityNameObj setValue:@"someValue" forKey:@"someKey"];
  </code></pre>
  
  <p>However, is there a way to delete and re-enter thumbnail, rather than have to go through and specify each new key value pairs? I ask because I updated the local db, thumbnail, with 200 new species, each of which is a directory with several images. </p>
  
  <p>The fetch request, if it applies: </p>
  
  <pre><code>    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
      NSManagedObjectContext* context = [(LeafletAppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext];
      NSEntityDescription *entity = [NSEntityDescription entityForName:@"Species" inManagedObjectContext:context] ;
      [fetchRequest setEntity:entity];
  
  
      if (predicate)
      {
          [fetchRequest setPredicate:predicate];
      }
  
      [fetchRequest setSortDescriptors:sortDescriptors];
  
      // Create and initialize the fetch results controller.
      NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:context sectionNameKeyPath:sectionNameKeyPath cacheName:nil];
  
      self.fetchedResultsController = aFetchedResultsController;
      fetchedResultsController.delegate = self;
  
      // Memory management.
      [aFetchedResultsController release];
      [fetchRequest release];
  
      return fetchedResultsController;
  </code></pre>