【发布时间】:2013-10-16 02:45:40
【问题描述】:
我似乎找不到任何可靠的文档来解释删除 UIManagedDocument 的正确过程,尤其是在 iCloud 选项已打开的情况下。
我了解此选项会删除此 fileURL 处的文件。如果不使用 iCloud,这似乎很好。
[[NSFileManager defaultManager] removeItemAtURL:fileURL error:&error];
如果使用 iCloud,CoreData 会在所有位置创建文件,包括在 /Document/CoreDataUbiquitySupport 和 iCloud /CoreData 文件夹中。所以在这种情况下,我是否可以在调用[NSFileManager removeItemAtURL] 之前为UIManagedDocument 中的每个商店调用removeUbiquitousContentAndPersistentStoreAtURL。如果是这样,这是否记录在某处?
[NSPersistentStoreCoordinator removeUbiquitousContentAndPersistentStoreAtURL:storeURL
options:@{NSPersistentStoreUbiquitousContentNameKey:fileName,
NSMigratePersistentStoresAutomaticallyOption:@YES,
NSInferMappingModelAutomaticallyOption:@YES,
NSSQLitePragmasOption:@{ @"journal_mode" : @"DELETE" }}
error:&error];
【问题讨论】:
标签: core-data icloud uimanageddocument