title: Model object and Core Data
body: <p>I have an object that I load up data from Core Data. I then modify the object with user inputs/choices.</p>
  
  <p>My first though was to override the setter methods for the properties:</p>
  
  <pre><code>-(void)setType:(NSString *)type {
      NSLog(@"setType fired | newType: %@", type);
  
      _type = type;
  
      appDelegate *appDelegate = (appDelegate *)[[UIApplication sharedApplication] delegate];
  
      NSManagedObjectContext *context = [appDelegate managedObjectContext];
  
      NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:DEFAULTS_DB];
  
      NSError *error;
  
      NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&amp;error];
  
      if (fetchedObjects.count == 1) {
          Defaults *defaults = [fetchedObjects objectAtIndex:0];
  
          defaults.sceneType = type;
      }
  
      if (![context save:&amp;error]) {
          NSLog(@"Error in saving first run defaults | error: %@", error);
      }
      else {
          NSLog(@"new type was saved to core data");
      }
  }
  </code></pre>
  
  <p>My other thought was to update the Core Data when <code>applicationWillResignActive:</code> fires (but that method only gets a few seconds to run before the app is frozen) and when the user logs out. </p>
  
  <p>The app i'm creating is one that the user would start up, set up what he wants, then puts it down 10-60min until he uses it again so i'm concerned with my app being killed while inactive and loosing the data.</p>
  
  <p>Is updating core data in the setter method a good way to handle updates or is it a really bad idea (too resource intensive, too slow)?</p>