iphone - 核心数据; cocoa 错误 134100

标签 iphone objective-c xcode core-data ios4

这是我第一次使用核心数据,我收到以下错误。

如果您能告诉我如何修复它,我将不胜感激。

Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x5927880 {metadata=<CFBasicHash 0x59269a0 [0x1007400]>{type = immutable dict, count = 7,
entries =>
    2 : <CFString 0x5926e10 [0x1007400]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x5927240 [0x1007400]>{type = immutable, count = 0, values = ()}
    4 : <CFString 0x5927190 [0x1007400]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x5926ca0 [0x1007400]>{value = +320, type = kCFNumberSInt64Type}
    6 : <CFString 0x59271c0 [0x1007400]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x5927340 [0x1007400]>{type = immutable dict, count = 2,
entries =>
    0 : <CFString 0x5927280 [0x1007400]>{contents = "Details"} = <CFData 0x59272f0 [0x1007400]>{length = 32, capacity = 32, bytes = 0x434e180241ecf461e59580e640ff926b ... aa456d1410ed9d1b}
    2 : <CFString 0x5927260 [0x1007400]>{contents = "History"} = <CFData 0x59272a0 [0x1007400]>{length = 32, capacity = 32, bytes = 0x3437f77a5563363f66b9d72ea76e0ff1 ... be194eb9dd17cddc}
}

    7 : <CFString 0xe238b0 [0x1007400]>{contents = "NSStoreUUID"} = <CFString 0x5926fc0 [0x1007400]>{contents = "6C5FECCB-0B64-46EB-809B-E0A4577D1E90"}
    8 : <CFString 0xe23720 [0x1007400]>{contents = "NSStoreType"} = <CFString 0xe238f0 [0x1007400]>{contents = "SQLite"}
    9 : <CFString 0x59271f0 [0x1007400]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0x4d13e20 [0x1007400]>{value = +3, type = kCFNumberSInt32Type}
    10 : <CFString 0x5927220 [0x1007400]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x5927380 [0x1007400]>{contents = "2"}
}
, reason=The model used to open the store is incompatible with the one used to create the store}, {
    metadata =     {
        NSPersistenceFrameworkVersion = 320;
        NSStoreModelVersionHashes =         {
            Details = <434e1802 41ecf461 e59580e6 40ff926b 20004ce9 58eb965f aa456d14 10ed9d1b>;
            History = <3437f77a 5563363f 66b9d72e a76e0ff1 ed7f70fd cb7035e9 be194eb9 dd17cddc>;
        };
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
        );
        NSStoreType = SQLite;
        NSStoreUUID = "6C5FECCB-0B64-46EB-809B-E0A4577D1E90";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}
sharedlibrary apply-load-rules all
Current language:  auto; currently objective-c
kill
quit
Program ended with exit code: 0

我的代码在这里: https://gist.github.com/898579

最佳答案

原因如下:

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

这是你如何做到的:

  1. 您创建了一些具有某些属性的实体并编写了一些代码
  2. 启动应用程序,可能添加了一些内容
  3. 退出应用程序并添加/更改了更多具有属性的实体
  4. 您可能再次启动了该应用程序,现在它给您错误

这是因为您的新托管对象模型正在尝试使用旧版本的存储(启动应用程序时第一次创建的存储)。

快速而肮脏的修复方法是删除存储文件(位于 ~/Library/Application Support/YOUR_APP/中的某处)并再次启动您的应用。

供将来引用 - 如果您发布了一个应用程序,并且在下一个版本中该应用程序更改了托管对象模型 - 您必须为其编写迁移。所有这些以及更多内容都包含在 Apple 文档的核心数据编程指南中。

关于iphone - 核心数据; cocoa 错误 134100,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5517129/

相关文章:

ios - coredata NSFetchRequest 一对多关系 托管对象上的关系错误

iOS App Today 扩展未上传到物理设备

ios - zPosition 和 subview 数组

iphone - iOS-Apple 推送通知从 APNS 重新发送

iphone - CodeName One 的表格布局

objective-c - 将对象添加到数组时程序崩溃

ios - NSNonLossyASCIIStringEncoding 返回 nil

ios - 如何像屏保一样改变CAGradientLayer的颜色?

c++ - 跳转到 lldb 中的行号

iphone - 从客户端发送推送通知