title: After Core Data lightweight migration to a version where a new attribute was added that attribute is nil
body: <p>I'm trying to setup some test lightweight migrations within my app's core data, but I've come across a bit of an odd problem.</p>
  
  <p>Between my version 2 and version 3 models of my app I've just added a new integer32 attribute. The attribute's default is set to 0 (the default that Xcode creates whenever you make a new attribute. I've tried testing this problem with the new attribute set to optional or not, it didn't make any difference.</p>
  
  <p>I used Xcode to auto generate the my NSManagedObject subclass which contains the new property I've added.</p>
  
  <p>I'm using UIManagedDocument to load my Core Data files and have set it up to perform an auto migration</p>
  
  <pre><code>NSDictionary *docOptions = @{
                          NSMigratePersistentStoresAutomaticallyOption : @YES,
                          NSInferMappingModelAutomaticallyOption : @YES
                          };
  self.document.persistentStoreOptions = docOptions;
  </code></pre>
  
  <p>I take a live set of data with the current document set to version 2 and then change the app over to version 3. I run it and the document successfully opens so I presume the migration has worked correctly. Not sure how to get any errors out of this when it does fail, there's nothing in my logs.</p>
  
  <p>Once I try to actually access the new attribute's NSNumber property of my NSManagedObject subclass for instances of the CoreData entity that I added I just find that the property is nil, rather than an NSNumber of default 0.</p>
  
  <p>All the tutorials, documentation and questions I can find on this don't seem to say that I should have to do anything else to get this working. </p>
  
  <p>If I work with the version 3 model cleanly and create new entities with that version then as you'd expect the new attribute is non-nil and so everything works ok. It's just migrating to this new version which doesn't seem to create the new attribute within the existing entity instances properly.</p>
  
  <p>Anyone's help would be appreciated as always! Cheers.</p>