核心数据 - 预先填充数据时不兼容的模型

时间:2014-02-28 00:32:38

标签: ios iphone database core-data ios5

我在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";
}

我试过......重置内容和设置..模型版本化数据模型..但没有工作......但是如果只有一个实体那么就没有这样的错误。这个错误出现时有多个实体。

1 个答案:

答案 0 :(得分:2)

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

更新:

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

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