Question

I try to implement Versions in application that already written for Snow Leopard. It is an Document based application with SQLite storage. Each document saves as an SQLite db file.

I have implemented appropriate methods in my NSPersistentDocument subclass:

+ (BOOL)autosavesInPlace {return YES;}
+ (BOOL)preservesVersions {return YES;}

Now I have new File menu in application with "Save a Version" etc. I create new document in my app, save it, make some changes, save again.. When I entering version browser I get:

kCGErrorFailure: CGSDisplayID: App trying to enumerate [0 to CGSGetNumberOfDisplays()] instead of using CGSGetDisplayList().  Compensating...
kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

In right side of version browser in list of versions I see few versions, but they do not displayed in stack of windows. It looks like windows are in stack but completely transparent. When I clicks on any version in list I get log:

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

Than if I tried to restore one of versions - version browser normally closed, no window appears and program stops responding.

I can't understand what it all can means. Is it problem in saving version or in restoring? I just have no ideas. Will be grateful for any help.

Was it helpful?

Solution

Each Core Data store is already stored on disk when the versions browser is opened. Have you looked at your overrides for creating the document, and for reading them? Are you sure none of them also edit the document? You might also want to check your awakeFromNib methods, to see that you are not writing / saving anything to a new document.

It can be difficult to debug problems when leaving the version browser. To make it easier, you can edit your current scheme, select the 'Options' tab, and check 'Enable debugging in "Browse all versions" mode'.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top