Removing NSPersistentHistoryTrackingKey causes error.

So when I turn off NSPersistentHistoryTrackingKey I get this error then the App Crashes:


error: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only mode store at ...


CoreData: error: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only mode store at...


error: (8) attempt to write a readonly database

CoreData: error: (8) attempt to write a readonly database


File is in Read Only mode due to Persistent History being detected but NSPersistentHistoryTrackingKey was not included


How do I turn it off without having this happen?


Ray

Replies

I've got the same issue. Were you able to resolve this?


- David

I believe I have my code working again.

For the record I had edited the Options... and removed two relating to iCloud. I had to put those changes back in again.


            options = @{NSMigratePersistentStoresAutomaticallyOption: @YES,                    // Key to automatically attempt to migrate versioned stores
                        NSInferMappingModelAutomaticallyOption: @YES,                          // Key to attempt to create the mapping model automatically
                        NSPersistentStoreUbiquitousContentNameKey: @"my_DataStore",  // Option to specify that a persistent store has a given name in ubiquity.
                        NSPersistentStoreUbiquitousContentURLKey: icloudURLForLogs,            // Option to specify the log path to use for ubiquitous content logs.
                        NSPersistentHistoryTrackingKey: @YES
                        };

- David

I have the same problem. Have you find any answer for this?
  • I had to do a persistent store copy and move to a new location delete the old core data persistent store.

Add a Comment