CoreData修改了数据模型报错 The model used to open the store is incompatible with the one used to create the store

在iOS 6 – Core Data 应用程序的开发过程中, App启动时出现如下异常信息:

reason = “The model used to open the store is incompatible with the one used to create the store”

出现上述异常的原因是 :我们修改了Data Model文件,增加了新的Entity,包括Attribute属性、Relationship关系等等。

解决办法:

(1) 最简单的办法是,在iOS 5 或者 6的模拟器中,删除App,然后重新运行就可以了。

(2) 第二种办法是使用Data Model 数据模型的版本属性:

给Data Model(也就是被管理对象模型)添加一个新的版本:

  1. 在项目导航栏中,选择Data Model 文件;
  2. 选择 Editor > Create Model Version 菜单项;
  3. 在对话框中,输入Data Model文件的名称,并点击Save按钮;

然后设置 Data Model的当前版本号:

  1. 在项目导航栏中,选择Data Model文件;
  2. 在File inspector 面板窗口,找到Versioned Core Data Model 节点;
  3. 从弹出菜单中,选择当前模板版本号;

时间: 2024-08-18 11:51:13

CoreData修改了数据模型报错 The model used to open the store is incompatible with the one used to create the store的相关文章

coreData报错:The model used to open the store is incompatible with the one used to create the store

报这个错误,说明你在运行这次程序时,更改了数据库中的表内容,比如更改了表属性,或者增加了一张表等.这个时候运行就会报这个错误.告诉你,用来创建数据库的模型和你用来打开数据库的模型是不相容的,也就是你动了这个model,动了数据库中表的内容.一般程序崩溃会在下面的函数崩溃: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (_persistentStoreCoordinator != nil) { return _

Django 使用allauth报错 RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

一:报错 RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS 出现这种情况需将Django的Sites框架添加到您的应用程序中,并在您的设置中将SITE_ID设置为1即可.位置放在默认配置的后面,其他应用的前面. INSTALLED_APPS = [ 'django

django配置mysql报错 no model named "MySQLdb"

官网上面连接mysql数据库的参数很少,入了不少坑,一直排错和检查参数都没有问题,只能manage.py mirgrate 更新数据库的信息创建数据库的表. 很是郁闷.报了一大堆的错误,大概意思就是说没有MySQLdb这个模块 . no model named "MySQLdb" 举手无措的我,吓尿了.翻了百度,查找方法,安装mysqldb,mysql-python试了很多个都不行. 最后想了想报错的最后一行.是否安装mysqlclient. 抱着试一试的心态,离线安装了一个mysql

Mysql5.7.18.1修改用户密码报错ERROR 1054 (42S22):

mysql> update user set password=password("新密码") where user="用户名";执行后报错 ERROR 1054(42S22) Unknown column 'password' in 'field list' 错误的原因是 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string 所以请使用一下命令: mysql -u root

SVN 修改log信息报错的解决方案

要实现允许修改log这个功能,只需要在hooks目录下增加一个名为:pre-revprop-change.bat的文件,重启svn即可.该文件内容为:-----------------------------------------------------------if "%4" == "svn:log" exit 0 echo Property '%4' cannot be changed >&2 exit 1 ------------------

Xcode CoreData 存储报错问题。

因项目接口变动,导致之前的CoreData字段需要调整.于是记录下出错的流程和解决方案.步骤如下: 1. 先在 *****.xcdatamodeld 文件中添加需要调整的字段.并更新本地model实体. 2. 我的流程是接到消息后本地存储在CoreData里面,然后UI展示(具体消息推送和接收问题,之前已经做好了,不在这里讲解.).因我是真机调试,收到消息推送后,但是一直无数据.于是想去本地sqlite里面查看是否已经将消息存储完毕,于是捕捉到路径并执行进入sqlite时问题来了: sqlite

coreData部分报错:This NSPersistentStoreCoordinator has no persistent stores.

最近在修改一个程序BUG的时候遇到一个问题coreData部分报错:This NSPersistentStoreCoordinator has no persistent stores. 但实际跑程序时.增删保存都没问题. 我花了很多的时间在问题抛出的地方在[contextsave:&error]; 后来发现,早在初期化_persistentStoreCoordinator 时就报错了 if (![_persistentStoreCoordinator addPersistentStoreWit

【原创】大叔经验分享(52)ClouderaManager修改配置报错

Cloudera Manager中修改配置可能报错: Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'MESSAGE' at row 1 这是一个mysql的字符集问题,极有可能创建scm数据库时使用默认的latin1编码导致,涉及的表为: CREATE TABLE `REVISIONS` ( `REVISION_ID` bigint(20) NOT NULL, `OPTIMISTIC_LOCK_VERSION`

usermod: user XXX is currently logged in 报错处理

修改用户账号时候报错 [[email protected] /]# usermod -s /bin/bash -d /home/z -g srd 678 usermod: user 678 is currently logged in 1查询用户678有哪些进程 [email protected] /]# ps aux |grep 678 root     24678  0.0  0.0 108336  1800 pts/1    S    Jan22   0:00 bash root