【问题标题】:Not Showing sqlite data in iphone在 iphone 中不显示 sqlite 数据
【发布时间】:2011-08-18 08:52:30
【问题描述】:

我有两个 Tabitems,在第一个 TabItems 中我有一个 NavigationViewController。现在,当我运行此应用程序时,它运行良好,但是当我使用 sqllite 获取数据并显示到 tableview 单元格时,它会崩溃。 崩溃日志在这里:

    2011-08-18 14:19:08.204 iBountyHunter[201:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x4d4e1a0 {metadata=<CFBasicHash 0x4d4d590 [0x1008400]>{type = immutable dict, count = 7,
entries =>
    2 : <CFString 0x4d4dc90 [0x1008400]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x4d4dd60 [0x1008400]>{type = immutable, count = 0, values = ()}
    4 : <CFString 0x4d4dce0 [0x1008400]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x4d4d7e0 [0x1008400]>{value = +248, type = kCFNumberSInt64Type}
    6 : <CFString 0x4d4dd10 [0x1008400]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x4d4ddf0 [0x1008400]>{type = immutable dict, count = 1,
entries =>
    1 : <CFString 0x4d4dd80 [0x1008400]>{contents = "Fugitive"} = <CFData 0x4d4dda0 [0x1008400]>{length = 32, capacity = 32, bytes = 0xe33370b6e7ca3101f91d25951e8bfe01 ... 9e50237bb313d390}
}

    7 : <CFString 0xe248b0 [0x1008400]>{contents = "NSStoreUUID"} = <CFString 0x4d4db00 [0x1008400]>{contents = "E711F65F-3C5A-4889-872B-6541E4B2863A"}
    8 : <CFString 0xe24720 [0x1008400]>{contents = "NSStoreType"} = <CFString 0xe248f0 [0x1008400]>{contents = "SQLite"}
    9 : <CFString 0x4d4d970 [0x1008400]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0x4d1e420 [0x1008400]>{value = +3, type = kCFNumberSInt32Type}
    10 : <CFString 0x4d4dd40 [0x1008400]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x4d4de40 [0x1008400]>{contents = "2"}
}
, reason=The model used to open the store is incompatible with the one used to create the store}, {
    metadata =     {
        NSPersistenceFrameworkVersion = 248;
        NSStoreModelVersionHashes =         {
            Fugitive = <e33370b6 e7ca3101 f91d2595 1e8bfe01 3e7fb4de 6ef2a31d 9e50237b b313d390>;
        };
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
        );
        NSStoreType = SQLite;
        NSStoreUUID = "E711F65F-3C5A-4889-872B-6541E4B2863A";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}

请帮助我解决这个问题。 我不知道问题出在哪里。 . . 提前致谢。

【问题讨论】:

    标签: iphone ios ios4 iphone-sdk-3.0


    【解决方案1】:

    您更改了模型。只需从您的设备/模拟器中删除该应用,然后重试。

    【讨论】:

    • 让我检查一下...谢谢您的回复
    • 我已经从模拟器中删除了应用程序,然后我运行了应用程序。现在根据应用程序生成新文件夹。在那个文件夹中,我用生成的 sqlite 文件替换了我现有的 sqlite 文件。但它仍然显示相同的错误。 . .我现在能做什么???
    • 如果您知道解决方案,请帮助我。
    • 当然,很高兴为您提供帮助。 - 您必须提供与对象模型匹配的 sqlite 文件。因此,您需要生成一个新的。每当对象模型发生变化时,所谓的“持久存储”也必须重新生成。
    • 好的,谢谢。我得到了它。 . .会试一试的。
    【解决方案2】:

    每次您对开发中的 iPhone 应用程序进行任何数据模型更改时,您都需要在尝试构建应用程序之前从 iPhone 模拟器或物理设备中删除该应用程序。在任一平台上删除应用程序时,都会删除与其关联的所有数据,包括使用现已过时的数据模型的数据库,这会导致 Xcode 抛出错误。

    【讨论】:

    • 我已经从模拟器中删除了应用程序,然后我运行了应用程序。现在根据应用程序生成新文件夹。在那个文件夹中,我用生成的 sqlite 文件替换了我现有的 sqlite 文件。但它仍然显示相同的错误。 . .我现在能做什么???
    • 如果您知道解决方案,请帮助我。
    【解决方案3】:

    这表明您更改了数据模型。您需要从设备中删除应用并重新构建项目的解决方案。

    reason = "开店的型号和开店的型号不兼容";

    因此,您不能简单地更改 Decuments 文件夹下的 .sqlite 数据库并使用 CoreData 重新运行应用程序,而是可以为此使用 .sqlite3 框架而不是 coreData。

    【讨论】:

      猜你喜欢
      • 2016-05-18
      • 2012-08-22
      • 2015-04-03
      • 2012-03-15
      • 2015-05-03
      • 1970-01-01
      • 1970-01-01
      • 2018-01-12
      • 1970-01-01
      相关资源
      最近更新 更多