nspersistentstore

Core Data. How to swap NSPersistentStores and inform NSFetchedResultsController?

一个人想着一个人 提交于 2019-12-02 12:04:47
I'm implementing backup and restore (via Dropbox) of a user's Core Data persisted data. For a restore I pull the files down from Dropbox and store them temporarily in the Documents directory. Then I create a new NSPersistentContainer and use it to replace the current persistent store (in the ApplicationSupport directory) before deleting the no longer needed files in the Documents directory. I'm using the MasterDetail template for now and so I have the usual time-stamped entities and the NSFetchedResultsController that comes along with that. Having made the replacement I swap back to the master

How to debug/handle intermittent “authorization denied” and “disk i/o” errors when adding SQL store to an NSPersistentStoreCoordinator?

社会主义新天地 提交于 2019-11-30 06:15:00
问题 I have an app in the app store and am using a logging service to get crash logs and associated log data. I am seeing an intermittent crash (low # of users affected and low # of crashes per user) but it is baffling me. What happens in these crashes is the following: App launches and initializes Core Data stack App attempts to add a SQL store to the NSPersistentStoreCoordinator with the following code ( storeURL is valid): NSDictionary *options = @{ NSMigratePersistentStoresAutomaticallyOption

How to debug/handle intermittent “authorization denied” and “disk i/o” errors when adding SQL store to an NSPersistentStoreCoordinator?

旧街凉风 提交于 2019-11-28 16:25:23
I have an app in the app store and am using a logging service to get crash logs and associated log data. I am seeing an intermittent crash (low # of users affected and low # of crashes per user) but it is baffling me. What happens in these crashes is the following: App launches and initializes Core Data stack App attempts to add a SQL store to the NSPersistentStoreCoordinator with the following code ( storeURL is valid): NSDictionary *options = @{ NSMigratePersistentStoresAutomaticallyOption : @(YES), NSInferMappingModelAutomaticallyOption : @(YES) }; sqlStore = [_persistentStoreCoordinator