用于打开商店的模型与用于创建商店的模型不兼容 [英] The model used to open the store is incompatible with the one used to create the store

查看:103
本文介绍了用于打开商店的模型与用于创建商店的模型不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在xcode 3.2中创建了一个Core Data模型,然后在Xcode 4.2中升级之后,我添加了一个NSManagedObject子类的新实体(参考新实体)。



<第一件事,它看起来很奇怪,因为它不是在同一组中的老。下面是我的xcode 4.2(AlkitabDB是我在xcode 3.2中创建的一个,EndeDB是从当前xcode版本(4.2)新的一个:





第二件事,我让它按原样,然后我访问第二个实体(新的)与第一个实体(旧的)相同的方式,并出现标题的错误。



这是错误:

  2012-01-16 21:13:38.496 iHuria [55953:207]未解决的错误Domain = NSCocoaErrorDomain Code = 134100操作无法完成。(Cocoa错误134100.)UserInfo = 0x8829cd0 {metadata =< CFBasicHash 0x882a370 [0x1839b38]> {type = immutable dict,count = 7,
entries =>
2:< CFString 0x8829b90 [0x1839b38]> {contents =NSStoreModelVersionIdentifiers} =< CFArray 0x8829ff0 [0x1839b38]> {type = immutable,count = 0,values = }
4:< CFString 0x8829bc0 [0x1839b38]> {contents =NSPersistenceFrameworkVersion} =< CFNumber 0x8829770 [0x1839b38]> {value = +320,type = kCFNumberSInt64Type}
6: ; CFString 0x8829bf0 [0x1839b38]> {contents =NSStoreModelVersionHashes} =< CFBasicHash 0x882a080 [0x1839b38]> {type = immutable dict,count = 1,
entries =
0:< CFString 0x882a010 [0x1839b38]> {contents =AlkitabDB} =< CFData 0x882a030 [0x1839b38]> {length = 32,capacity = 32,bytes = 0xd02ac5f8be6ab0b39add450aca202ac0 ... 3d45d462998d2ccd} $ bFbring =CFSingUUID} =< CFString 0x8829e60 [0x1839b38]> {content =4F2EE7FF-463B-4055- BBite-8E603CDBDF59}
8:< CFString 0x10e3948 [0x1839b38]> {content =NSStoreType} =< CFString 0x10e3958 [0x1839b38]> {content =SQLite}
9: < CFString 0x8829c40 [0x1839b38]> {content =NSStoreModelVersionHashesVersion} =< CFNumber 0x6b1c7c0 [0x1839b38]> {value = +3,type = kCFNumberSInt32Type}
10:< CFString 0x8829c70 [0x1839b38] ; {contents =_NSAutoVacuumLevel} =< CFString 0x882a0c0 [0x1839b38]> {content =2}
}
,reason =用于打开商店的模型与使用的模型不兼容创建商店},{
metadata = {
NSPersistenceFrameworkVersion = 320;
NSStoreModelVersionHashes = {
AlkitabDB =< d02ac5f8 be6ab0b3 9add450a ca202ac0 ebd1e860 cbb578c2 3d45d462 998d2ccd> ;;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers =(
);
NSStoreType = SQLite;
NSStoreUUID =4F2EE7FF-463B-4055-BBED-8E603CDBDF59;
_NSAutoVacuumLevel= 2;
};
reason =用于打开商店的模型与用于创建商店的模型不兼容;
}

我之前找到了解决方案,发现我应该从模拟器中删除应用程序并重新运行应用程序,它没有工作。
有没有人知道这个问题的解决方案?
请帮助。

解决方案

从模拟器中删除应用程序并对项目执行干净。这应该清除这些问题。确保您在删除应用程序时不在调试器中运行,否则不会真正将其正确删除。



如果您想确定它已删除,请检查此目录 Users / INSERT_YOUR_USER_HERE / Library / Application Support / iPhone Simulator / 为您的应用程序的文件夹下运行的版本。



注意:这仅用于开发。对于生产,您需要实现某种迁移。 Google核心数据迁移,轻量级迁移是最简单的。


I created a Core Data model in xcode 3.2 and after upgrading in Xcode 4.2, I then added a new entity of the NSManagedObject subclass (refer to the new entity).

First thing, it looks weird because it's not in the same group as the old one. Here is the picture on my xcode 4.2 (AlkitabDB is the one i created in xcode 3.2, EndeDB is the new one from current xcode version(4.2):

Second thing, I let it as it is, then I accessed the second entity (the new one) the same way as the first entity (the old one), and the error as titled appears.

Here is the error:

2012-01-16 21:13:38.496 iHuria[55953:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x8829cd0 {metadata=<CFBasicHash 0x882a370 [0x1839b38]>{type = immutable dict, count = 7,
entries =>
    2 : <CFString 0x8829b90 [0x1839b38]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x8829ff0 [0x1839b38]>{type = immutable, count = 0, values = ()}
    4 : <CFString 0x8829bc0 [0x1839b38]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x8829770 [0x1839b38]>{value = +320, type = kCFNumberSInt64Type}
    6 : <CFString 0x8829bf0 [0x1839b38]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x882a080 [0x1839b38]>{type = immutable dict, count = 1,
entries =>
    0 : <CFString 0x882a010 [0x1839b38]>{contents = "AlkitabDB"} = <CFData 0x882a030 [0x1839b38]>{length = 32, capacity = 32, bytes = 0xd02ac5f8be6ab0b39add450aca202ac0 ... 3d45d462998d2ccd}
}

    7 : <CFString 0x10e3aa8 [0x1839b38]>{contents = "NSStoreUUID"} = <CFString 0x8829e60 [0x1839b38]>{contents = "4F2EE7FF-463B-4055-BBED-8E603CDBDF59"}
    8 : <CFString 0x10e3948 [0x1839b38]>{contents = "NSStoreType"} = <CFString 0x10e3958 [0x1839b38]>{contents = "SQLite"}
    9 : <CFString 0x8829c40 [0x1839b38]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0x6b1c7c0 [0x1839b38]>{value = +3, type = kCFNumberSInt32Type}
    10 : <CFString 0x8829c70 [0x1839b38]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x882a0c0 [0x1839b38]>{contents = "2"}
}
, reason=The model used to open the store is incompatible with the one used to create the store}, {
    metadata =     {
        NSPersistenceFrameworkVersion = 320;
        NSStoreModelVersionHashes =         {
            AlkitabDB = <d02ac5f8 be6ab0b3 9add450a ca202ac0 ebd1e860 cbb578c2 3d45d462 998d2ccd>;
        };
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
        );
        NSStoreType = SQLite;
        NSStoreUUID = "4F2EE7FF-463B-4055-BBED-8E603CDBDF59";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}

I looked for the solution before and discovered that I should remove the appliation from simulator and rerun the app, and it didn't work. Does anyone know a solution for this issue? Please help.

解决方案

Remove the app from the simulator and perform a clean on your project. That should clear those issues up. Make sure that you are not running in the debugger when you delete the app or else it won't actually delete it properly.

If you want to be sure its gone, check this directory Users/INSERT_YOUR_USER_HERE/Library/Application Support/iPhone Simulator/ for your app's folder, under the version you're running.

Note: This is for development only. For production, you need to implement some sort of migration. Google "Core Data Migration", with lightweight migration being the simplest.

这篇关于用于打开商店的模型与用于创建商店的模型不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆