Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've now found out that this is quite simple - once you know where to look.# In my AppDelegate I set-up the NSPersistentStoreCoordinator - and you need to add some options to this to tell it to handle auto-migrate:</p> <pre><code> NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; NSError *error; _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&amp;error]) {       // Handle error     NSLog(@"Problem with PersistentStoreCoordinator: %@",error); } </code></pre> <p>Then you need to do in xCode:</p> <pre><code>1. Select your xcdatamodeld file 2. Select the Editor Menu at the top - then choose Add Model Version 3. Now your xcdatamodeld file have two (modelname.xcdatamodel &amp; modelname2.xcdatamodel ) . 4. Now modelname.xcdatamodel have the green check mark implies it is current version, but we need to change the modelname2.xcdatamodel as a current version 5. Select the xcdatamodeld file and then select the View Menu at the top - then Choose Utilities - then Choose the Show File Inspector is shown in right side of Xcode and then Select the Versioned Core Data Model - have Current(DropDownList) - select modelname2(the one you just made current version have green check mark). 6. Now when you install this version onto a device that has the old model - it will automatically upgrade that model to the new model. </code></pre> <p>This seems great and as simple as I wanted - but I think you need to be careful during development as you change a model - otherwise you will have to create a new version for each change.</p> <p>I think what I will do is that I will keep all of the changed files and then once I get ready to deploy my update I'll delete all the in-between files and just deploy with the oldest and latest models.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload