Ios 核心数据存储迁移问题

Ios 核心数据存储迁移问题,ios,objective-c,core-data,Ios,Objective C,Core Data,将CoreData迁移到新版本时出现以下错误。我正在使用CoreData的自动迁移。我的CoreData存储文档,似乎当数据量很大时,这种情况就会发生。核心数据将无法使用自动迁移来迁移大型数据。崩溃后,当我检查文档目录时,它显示以下文件: Documents/.appname.sqlite.migrationdestination_xxxx Documents/.appname.sqlite.migrationdestination_xxxx-shm Documents/.appname.sq

将CoreData迁移到新版本时出现以下错误。我正在使用CoreData的自动迁移。我的CoreData存储文档,似乎当数据量很大时,这种情况就会发生。核心数据将无法使用自动迁移来迁移大型数据。崩溃后,当我检查文档目录时,它显示以下文件:

  • Documents/.appname.sqlite.migrationdestination_xxxx
  • Documents/.appname.sqlite.migrationdestination_xxxx-shm
  • Documents/.appname.sqlite.migrationdestination_xxxx-wal
  • Documents/appname.sqlite Documents/appname.sqlite-shm
  • 文档/appname.sqlite-wal
错误:

数据库位于 /var/mobile/Containers/Data/Application/782EE7A8-729F-429C-84AF-501B5F866592/Documents/DocViewer.sqlite 他被腐蚀了。SQLite错误代码:11,'数据库磁盘映像为 畸形的

以下是我对persistentStore的实现:

 - (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
    if (_persistentStoreCoordinator != nil)
    {
        return _persistentStoreCoordinator;
    }

    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"DocViewer.sqlite"];
    //738001
    NSDictionary *options = @{
                              NSMigratePersistentStoresAutomaticallyOption : @YES,
                              NSInferMappingModelAutomaticallyOption : @YES,
                              NSSQLitePragmasOption:@{@"journal_mode":@"DELETE"}
                              };
    NSError *error = nil;
    _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
    if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
    {
        ADLog(@"Unresolved error %@, %@", error, [error userInfo]);



        //abort();
    }

    storeURL = nil;
    options = nil;

    return _persistentStoreCoordinator;
}

为什么要更改日志模式?默认日志模式的主要目的之一是避免损坏。我尝试了使用和不使用日志模式,结果与上面的错误相同。看起来我有大量的二进制数据,所以自动轻量级迁移是不可能的,我必须使用部分迁移来映射模型。除了用于迁移的映射模型,还有其他方法吗?我们尝试了映射模型迁移,但对于大数据,这也失败了。现在我们如何从映射模型实现块迁移。有关于这个的教程吗。我非常担心不同实体之间的关系。