CloudCore icon indicating copy to clipboard operation
CloudCore copied to clipboard

Override Persistent History Clearing

Open deeje opened this issue 6 years ago • 1 comments

currently, CloudCore assumes ownership of NSPersistentHistoryTracking, clearing out history after its been properly pushed to CloudKit. But NSPersistentHistoryTracking is also useful for shared containers and app extensions. Need to refactor such that apps can override default history clearing behavior.

deeje avatar Feb 15 '19 23:02 deeje

How would you handle the replacement of Core Data?

do {
       try container.persistentStoreCoordinator.replacePersistentStore(at: storeUrl, destinationOptions: nil, withPersistentStoreFrom: inputURL, sourceOptions: nil, ofType: NSSQLiteStoreType)
} catch {
      print("Failed to replace persistent container...NC") }//End do-catch
}

I can successfully load the Core Data backup but get NSPersistentHistoryToken errors:

Fatal error: Unresolved error Error Domain=NSCocoaErrorDomain Code=134501 "(null)" UserInfo={Reason=Store - (
    "4F49429F-3853-4978-9A43-AE28A1B644AE"
) not found in token - <NSPersistentHistoryToken - {
    "4F49429F-3853-4978-9A43-AE28A1B644AE" = 1;
}>}, ["Reason": Store - (
    "4F49429F-3853-4978-9A43-AE28A1B644AE"
)

I'm having a hard time Manually clearing Persistent History Tokens. Any advice?

noecantu avatar Jan 13 '20 21:01 noecantu