CoreData版本升级和数据迁移

来源:互联网 发布:淘宝老a的店铺 编辑:程序博客网 时间:2024/06/11 23:32
如果我们CoreData中的数据 发生了迁移或者说 版本发生了变化,我们需要在Appdelegate.m里面给其 设置 条件。    // 数据迁移    NSDictionary *options = @{                              NSMigratePersistentStoresAutomaticallyOption:@YES,                              NSInferMappingModelAutomaticallyOption:@YES                              };然后将永久保存类型  的options设置为options
<pre name="code" class="html">1. app代理中设置条件2. Editor-》new model version3. 侧边栏 -》 model version 选择4. 更新模型 (实体)



0 0