【问题标题】:Deleting CoreData journaling mode not migrating to new store删除 CoreData 日志模式不迁移到新存储
【发布时间】:2014-07-15 15:40:15
【问题描述】:

由于 MagicalRecord 3.0 还没有发布,我升级到 2.3 并尝试“关闭”日志模式。这是我的代码:

    //  Code to disable journaling mode
NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];

NSString *applicationDocumentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *urlString = [applicationDocumentsDirectory stringByAppendingPathComponent: @"saori.sqlite"];
NSURL *url = [NSURL fileURLWithPath:urlString];
NSDictionary *options = @{NSSQLitePragmasOption:@{@"journal_mode":@"DELETE"}};
NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel];
[psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil  URL:url options:options error:nil];

发生的事情是它不仅没有关闭日志模式,而且还创建了一个全新的(读取 )CoreData 存储带有日志功能。

在 MR 3.0 之外我可以做些什么,以便将日志存储的内容迁移到新的 CoreData 存储而不使用日志?

【问题讨论】:

    标签: core-data ios7 magicalrecord


    【解决方案1】:

    MagicalRecord 3.0 不会改变这是否有效。这是一个 CoreData 功能。 MR 3.0 将为您提供一种方法来指定添加特定商店的选项,因此代码更少。但是,Journalling 或 WAL 模式是一个问题,这是 CoreData 本身如何工作的基础。在这种情况下,迁移到 MR3 可能对您没有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-17
      • 1970-01-01
      • 1970-01-01
      • 2017-07-24
      • 1970-01-01
      • 2016-02-06
      • 2011-08-22
      • 1970-01-01
      相关资源
      最近更新 更多