神奇的记录迁移失败"无法找到源存储的模型"

 单莼de笑脸 发布于 2022-12-23 13:00

我们对CoreData模型进行了一些更改,看起来自动迁移失败了.

即使我们将当前模型设置为我们用于生成数据的原始模型,仍然存在错误:

reason ="找不到源存储的模型";

2014-09-05 02:19:43.297[948:166846] -[LBAppDelegate application:willFinishLaunchingWithOptions:] line 132 $ WILL FINISH!!
2014-09-05 02:19:43.402[948:166846] +[LBParse ensureUserObjectExists] line 107 $ dont save
2014-09-05 02:19:52.395[948:166846] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/0B3D4097-940C-433F-B6E5-E0EA6B08992F/Library/Applicat... options:{
    NSInferMappingModelAutomaticallyOption = 1;
    NSMigratePersistentStoresAutomaticallyOption = 1;
    NSSQLitePragmasOption =    {
        "journal_mode" = WAL;
    };
} ... returned error Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)" UserInfo=0x180f8620 {URL=file:///var/mobile/Containers/Data/Application/0B3D4097-940C-433F-B6E5-E0EA6B08992F/Library/Applicat..., metadata={
    NSPersistenceFrameworkVersion = 519;
    NSStoreModelVersionHashes =    {
        AccessItem = ;
        AccessRule = ;
        Airline = ;
        Airport = <09e93c0e fbf1e542 d1428584 30549a84 2e0cb9d3 8b50a508 31807dec d7e5f845>;
        Alliance = ;
        AllianceTier = <6ec8bee0 5d4c62f8 1411eaab b464d783 c6388b12 06506824 f11d6453 a58e509a>;
        Amenity = <86065297 64aff55b b7bfec32 e8e14b74 5d7afa5b 751e760e e37e6294 2e40e26a>;
        Data = <92870bec c4a8794e 293dcbe9 93282d69 cb675039 cb9b9bf6 8dda6359 34697663>;
        Event = ;
        FeedItem = <1d0d12fc 82eb532a c1a42ad3 57022129 2c44360e ab5514ce a44d6de0 719ca798>;
        Image = <94e1ad81 4a2aa37b 6a02a52e fb481891 5028fafc 0645de55 7316e5d9 f630ca85>;
        Lounge = <57e5d036 c67f1f9d b3c731a6 4136866e 008684b0 f2ec0620 58e6e56c dbbed4fe>;
        ParseObject = ;
        Review = ;
        User = <8451767f db80e10a 15ea83d8 83dc1a2c e89d1699 0b302640 59a23144 61c65be0>;
        Vote = <38d267c9 0c44854e dd01201c b728b906 21fd25cd 8343a416 adf769c6 faef7cb6>;
    };
    NSStoreModelVersionHashesVersion = 3;
    NSStoreModelVersionIdentifiers =    (
        ""
    );
    NSStoreType = SQLite;
    NSStoreUUID = "222748EF-2F19-4B87-829C-F8171E439430";
    "_NSAutoVacuumLevel" = 2;
}, reason=Can't find model for source store} with userInfo dictionary {
    URL = "file:///var/mobile/Containers/Data/Application/0B3D4097-940C-433F-B6E5-E0EA6B08992F/Library/Applicat...";
    metadata =    {
        NSPersistenceFrameworkVersion = 519;
        NSStoreModelVersionHashes =        {
            AccessItem = ;
            AccessRule = ;
            Airline = ;
            Airport = <09e93c0e fbf1e542 d1428584 30549a84 2e0cb9d3 8b50a508 31807dec d7e5f845>;
            Alliance = ;
            AllianceTier = <6ec8bee0 5d4c62f8 1411eaab b464d783 c6388b12 06506824 f11d6453 a58e509a>;
            Amenity = <86065297 64aff55b b7bfec32 e8e14b74 5d7afa5b 751e760e e37e6294 2e40e26a>;
            Data = <92870bec c4a8794e 293dcbe9 93282d69 cb675039 cb9b9bf6 8dda6359 34697663>;
            Event = ;
            FeedItem = <1d0d12fc 82eb532a c1a42ad3 57022129 2c44360e ab5514ce a44d6de0 719ca798>;
            Image = <94e1ad81 4a2aa37b 6a02a52e fb481891 5028fafc 0645de55 7316e5d9 f630ca85>;
            Lounge = <57e5d036 c67f1f9d b3c731a6 4136866e 008684b0 f2ec0620 58e6e56c dbbed4fe>;
            ParseObject = ;
            Review = ;
            User = <8451767f db80e10a 15ea83d8 83dc1a2c e89d1699 0b302640 59a23144 61c65be0>;
            Vote = <38d267c9 0c44854e dd01201c b728b906 21fd25cd 8343a416 adf769c6 faef7cb6>;
        };
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =        (
            ""
        );
        NSStoreType = SQLite;
        NSStoreUUID = "222748EF-2F19-4B87-829C-F8171E439430";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "Can't find model for source store";
}
2014-09-05 02:19:52.404 [948:166846] CoreData: annotation: NSPersistentStoreCoordinator's current model hashes are {
    AccessItem = ;
    AccessRule = ;
    Airline = ;
    Airport = <09e93c0e fbf1e542 d1428584 30549a84 2e0cb9d3 8b50a508 31807dec d7e5f845>;
    Alliance = ;
    AllianceTier = <6ec8bee0 5d4c62f8 1411eaab b464d783 c6388b12 06506824 f11d6453 a58e509a>;
    Amenity = <86065297 64aff55b b7bfec32 e8e14b74 5d7afa5b 751e760e e37e6294 2e40e26a>;
    FeedItem = <1d0d12fc 82eb532a c1a42ad3 57022129 2c44360e ab5514ce a44d6de0 719ca798>;
    Image = <94e1ad81 4a2aa37b 6a02a52e fb481891 5028fafc 0645de55 7316e5d9 f630ca85>;
    Lounge = <57e5d036 c67f1f9d b3c731a6 4136866e 008684b0 f2ec0620 58e6e56c dbbed4fe>;
    ParseObject = ;
    Review = ;
    User = <8451767f db80e10a 15ea83d8 83dc1a2c e89d1699 0b302640 59a23144 61c65be0>;
    Vote = <38d267c9 0c44854e dd01201c b728b906 21fd25cd 8343a416 adf769c6 faef7cb6>;
}

casademora.. 9

你有一个型号,但它与商店不兼容.在我看来,你在没有添加版本的情况下对模型进行了更改.使用任何Core Data迁移,您都需要源模型和目标模型.也就是说,Core Data需要知道原始数据的样子,以及新数据的样子.然后,核心数据可以推断(推断)自动迁移模型之间的变化.由于在这种情况下找不到源模型,并且我假设您仍然有项目中的模型,因此您可能在不添加版本的情况下更改了数据模型.希望您使用的是某些源代码控制,并且可以恢复到与商店匹配的dat模型版本.从那里,你需要' 添加模型版本 '.在其中一个Xcode菜单中查找它.您还需要确保新版本是当前模型版本,以便正确启动迁移.

而且,如果您正在使用MagicalRecord,则可以使用一种在附加商店时迁移数据的简单帮助方法.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有