Re: Versions, -windowWillClose:
Re: Versions, -windowWillClose:
- Subject: Re: Versions, -windowWillClose:
- From: Dave Fernandes <email@hidden>
- Date: Sun, 22 Jan 2012 10:56:23 -0500
You can set a breakpoint in the normal document opening methods such as -[NSDocument initWithContentsOfURL:ofType:error:] to see what URL the versioned documents are being loaded from.
On 2012-01-22, at 10:06 AM, Martin Hewitson wrote:
>
> On 21, Jan, 2012, at 07:31 PM, Mike Abdullah wrote:
>
>>
>> On 3 Jan 2012, at 15:25, Martin Hewitson wrote:
>>
>>> Dear list,
>>>
>>> I'm investigating getting the new 10.7 Versions stuff working on my NSPersistentDocument app. In doing that, I've seen a couple of strange things which I wanted to check on.
>>>
>>> Firstly, all I've done to make it work is to return YES from +autosavesInPlace.
>>>
>>> Now, what I notice is the following sequence of events:
>>>
>>>
>>> 1) App starts:
>>> windowControllerDidLoadNib <NSWindow: 0x10055d970>
>>> 2) Enter Versions browser
>>> NSDocumentRevisionsDebugMode=YES
>>> <Error>: kCGErrorFailure: CGSDisplayID: App trying to enumerate [0 to CGSGetNumberOfDisplays()] instead of using CGSGetDisplayList(). Compensating...
>>> <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
>>> windowControllerDidLoadNib <NSWindow: 0x1091939c0>
>>> Entered Versions: NSConcreteNotification 0x108658620 {name = NSWindowDidEnterVersionBrowserNotification; object = <NSWindow: 0x10055d970>}
>>> 3) Exit Versions (by clicking Done button in Versions browser)
>>> Window will close <NSWindow: 0x1091939c0> / <NSWindow: 0x1091939c0>
>>> Open windows 1 (logged in windowWillClose:)
>>> Exited Versions: NSConcreteNotification 0x1091a22c0 {name = NSWindowDidExitVersionBrowserNotification; object = <NSWindow: 0x10055d970>}
>>> 4) Exit App
>>> Window will close <NSWindow: 0x10055d970> / <NSWindow: 0x10055d970>
>>> Open windows 1 (logged in windowWillClose:)
>>>
>>> Some questions:
>>>
>>> a) Why is it that I don't have 2 open windows in step 3)?
>>> b) What is the first window doing while the Versions browser is open? It seems the same document is opened again, judging by the NSWindow objects.
>>> c) What are the Errors reported just after entering Versions?
>>
>> The CG errors happen in all apps; seems to be a side-effect of however Apple have implemented Versions.
>
> OK, good to know.
>
>>>
>>> Perhaps I'm not understanding how this stuff works yet, so any enlightenment would be gratefully received.
>>>
>>> As a side question, where are the different versions of the document kept? I've read that they are kept in the document, but inspection of the (XML-based) Core Data document shows that's not the case. The app is actually a manager of other (text) files on disk, and I'm amazed to see that the versions actually reflect the state of the managed text files, even though the save core data document does not store the file contents. The file contents are stored temporarily in a core data entity as a transient property. Can I then conclude that these transient properties are stored in the different versions? I've tried reading through the documentation on this, and I've watched the WWDC11 session on this, but perhaps I need to do that again.
>>
>> It's entirely private to the OS where and how it chooses to store the historical versions of your documents.
>>
>
>
> True, but it would be very useful in the debugging/understanding process to be able to inspect the contents of the previous versions. Of course, if we had decent documentation on this, that might not be necessary. Alas....
>
> Martin
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Martin Hewitson
> Albert-Einstein-Institut
> Max-Planck-Institut fuer
> Gravitationsphysik und Universitaet Hannover
> Callinstr. 38, 30167 Hannover, Germany
> Tel: +49-511-762-17121, Fax: +49-511-762-5861
> E-Mail: email@hidden
> WWW: http://www.aei.mpg.de/~hewitson
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden