0

Because I am using a custom core data stack, I am overwriting the init, readFromURL, writeToURL, and revertToContentsOfURL functions.

When I click "Browse all versions", previous versions of my file are openend and init is called. However I get the following error:

Attempt to add read-only file at path ... Adding it read-only instead.
This will be a hard error in the future;
you must specify the NSReadOnlyPersistentStoreOption.

My question is now: how do I know if the file being opened is a regular file or a versioned file?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
user965972
  • 2,489
  • 2
  • 23
  • 39

1 Answers1

0

Ok, found it. In a subclass of NS(Persistent)Document, when determining the options for your NSPersistentStore.

if self.inViewingMode {
     [NSSQLitePragmasOption: yourPragmaOptions,
      NSReadOnlyPersistentStoreOption: "YES"] }
user965972
  • 2,489
  • 2
  • 23
  • 39