title: Keypath not found in entity error but I can insert into data store
body: <p>I get this error: </p>
  
  <blockquote>
    <p>core data data store missing getting error:'NSInvalidArgumentException', 
        reason: keypath flowData.flowAmount not found in entity &lt;NSSQLEntity FlowData id=1></p>
  </blockquote>
  
  <p>when trying to load data from a core data store into a tableview. </p>
  
  <p>The sqlite database is being re-created the next time I run the app after I remove the app from the Simulator after having changed the data model and reversioned it.</p>
  
  <p>I am able to insert into the database. This dump shows the record I just entered:</p>
  
  <pre><code>INSERT INTO "ZFLOWDATA" 
  VALUES(1,1,1,NULL,8.0,376884478.384176,376884471.83175,8.0);
  </code></pre>
  
  <p>However when I try to read from the data store I get the above error.</p>
  
  <p>Here's the relevant code for when I'm trying to load the data:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      NSError *error;
       if (![[self fetchedResultsController] performFetch:&amp;error]) {
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            exit(-1);  // Fail
       }
      self.title = @"Flow Data Items";
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>- (NSFetchedResultsController *)fetchedResultsController {
  
  
  
      jhsAppDelegate *appDelegate = (jhsAppDelegate *)[[UIApplication sharedApplication]delegate];
  
      managedObjectContext = [appDelegate managedObjectContext];
  
  
  
      if (fetchedResultsController != nil) {
          return fetchedResultsController;
  
      }
      NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  
      NSEntityDescription *entity = [NSEntityDescription
                                     entityForName:@"FlowData" inManagedObjectContext:managedObjectContext];
  
      [fetchRequest setEntity:entity];
  
      NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"FlowData.flowAmount"
                                                           ascending:NO];
  
      [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];    
      [fetchRequest setFetchBatchSize:20];
      NSFetchedResultsController *theFetchedResultsController =
      [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                          managedObjectContext:managedObjectContext sectionNameKeyPath:nil
                                                     cacheName:@"Root"];
  
      self.fetchedResultsController = theFetchedResultsController;
      self.fetchedResultsController.delegate = self;
      return fetchedResultsController;
  }
  </code></pre>
  
  <p>and here's my data model:</p>
  
  <p><img src="https://i.stack.imgur.com/Oj1zx.png" alt="enter image description here"></p>
  
  <p>and finally, here's my data model class code for the entity:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  @interface FlowData : NSManagedObject
  
  @property (nonatomic, retain) NSNumber * flowAmount;
  @property (nonatomic, retain) NSDate * flowEnteredDateTime;
  @property (nonatomic, retain) NSDate * flowOccurrenceDateTime;
  @property (nonatomic, retain) NSNumber * flowScheduledFrequencyMinutes;
  @property (nonatomic, retain) NSNumber * flowUrgency;
  
  @end
  </code></pre>
  
  <p>It must be something about how I am trying to read in the data since I am able to insert a row on another viewcontroller because I believe that <code>FlowData.flowAmount</code> does exist on the entity as it is being inserted into the entity.</p>
  
  <p>Any ideas? Does the order in which the attributes are listed in the .h file have to match the order in the actual data model? Do my data types match?</p>