【问题标题】:Core Data - incompatible Model while pre-populating data核心数据 - 预填充数据时不兼容的模型
【发布时间】:2014-02-28 00:32:38
【问题描述】:

我在 Xcode 的新项目中添加预填充数据时遇到此错误。

Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x8936000 {metadata={
    NSPersistenceFrameworkVersion = 407;
    NSStoreModelVersionHashes =     {
        Cleaner = <bb90421c 1d099882 3b9c4615 f58bb6d2 b9f1e567 c98e868e 5f467f7c d34be700>;
        Location = <7f9bec7a 3e3692f8 ca426545 7239c5c8 ea704142 8614e1fd 7681eaaf 5dbb1586>;
        LocationRoomMap = <f1052409 bfe4fb62 b7c45b85 2f34ab74 109c09df 07bc69ff a1a130bc 3dd23ced>;
        Login = <39315a04 8bf4a9f5 e1fd123d 41854f3c 8891af2b ddffdb43 2fa32209 574af392>;
        Room = <d07972d5 5b089bdd 2fa7afde f723f5a8 abb7548d 9cfe9fc6 bb343b9d 3094d12e>;
        TestPlan = <e47ccac2 197bd2a1 41e295b2 66fcc993 1671b53d 88b90334 3942dab4 1eed766e>;
        TestPoint = <e6806bd5 bba33811 c55ea3cd 8d8e0c89 9a8742f2 5c7b19f9 d285b7d2 ae5eab96>;
    };
    NSStoreModelVersionHashesVersion = 3;
    NSStoreModelVersionIdentifiers =     (
        ""
    );
    NSStoreType = SQLite;
    NSStoreUUID = "3D9D9EB1-5ED3-47DB-8B76-F6E4051B435E";
    "_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store}, {
    metadata =     {
        NSPersistenceFrameworkVersion = 407;
        NSStoreModelVersionHashes =         {
            Cleaner = <bb90421c 1d099882 3b9c4615 f58bb6d2 b9f1e567 c98e868e 5f467f7c d34be700>;
            Location = <7f9bec7a 3e3692f8 ca426545 7239c5c8 ea704142 8614e1fd 7681eaaf 5dbb1586>;
            LocationRoomMap = <f1052409 bfe4fb62 b7c45b85 2f34ab74 109c09df 07bc69ff a1a130bc 3dd23ced>;
            Login = <39315a04 8bf4a9f5 e1fd123d 41854f3c 8891af2b ddffdb43 2fa32209 574af392>;
            Room = <d07972d5 5b089bdd 2fa7afde f723f5a8 abb7548d 9cfe9fc6 bb343b9d 3094d12e>;
            TestPlan = <e47ccac2 197bd2a1 41e295b2 66fcc993 1671b53d 88b90334 3942dab4 1eed766e>;
            TestPoint = <e6806bd5 bba33811 c55ea3cd 8d8e0c89 9a8742f2 5c7b19f9 d285b7d2 ae5eab96>;
        };
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
            ""
        );
        NSStoreType = SQLite;
        NSStoreUUID = "3D9D9EB1-5ED3-47DB-8B76-F6E4051B435E";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}

我试过...重置内容和设置..数据模型的模型版本控制..但没有奏效...但是如果那里只有一个实体,那么就不会出现这样的错误。这个错误出现在存在不止一个实体。

【问题讨论】:

    标签: ios iphone database core-data ios5


    【解决方案1】:

    我有一个类似的问题(虽然不是完全相同的问题),这是由于我在创建 SQLite 数据库文件后对模型进行了更改而引起的。我不得不从 Debug 文件夹中删除 SQLite 数据库(应该在你的应用程序编译到的地方创建),然后再次构建应用程序。使用我更新的模型创建了一个新的 SQLite 数据库。希望这是有道理的,并有所帮助。

    更新:

    这个和其他建议的解决方案可以在 stackoverflow 的其他地方找到:

    The model used to open the store is incompatible with the one used to create the store

    【讨论】:

    • 嘿 cullener ...我在 iphone 模拟器中运行这个应用程序.. 你能告诉我这个文件夹 [Debug 文件夹(应该在你的应用程序编译到的地方创建)] 在哪里吗?
    • 您的意思是应用程序所在的库中的文件夹吗?我试过那个..我删除了它..甚至从垃圾箱中删除,但它不起作用
    • 在 /Library/Developer/Xcode/DerivedData 中查看以您的应用程序名称开头的文件夹。检查那里是否有旧版本的 SQLite 数据库
    • 您确定模型中的实体与您的数据库完全匹配吗?
    • 是的..但是那里有大量实体..让我再做一次..做完后会回复你..
    猜你喜欢
    • 2013-10-26
    • 1970-01-01
    • 2011-12-23
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 2017-01-10
    • 1970-01-01
    • 2012-12-18
    相关资源
    最近更新 更多