Re: How to implement Autosaving, Browsing Versions, Reverting to Last Saved in Lion?
Re: How to implement Autosaving, Browsing Versions, Reverting to Last Saved in Lion?
- Subject: Re: How to implement Autosaving, Browsing Versions, Reverting to Last Saved in Lion?
- From: Kevin Perry <email@hidden>
- Date: Tue, 26 Jul 2011 11:00:34 -0700
There is nothing that you are obviously doing wrong here. Please file a Radar with your test app attached.
-KP
On Jul 24, 2011, at 7:46 PM, Zorg wrote:
> I'm having a difficult time figuring out how to implement these features correctly in Lion. I've created a very simple NSDocument based test app: http://pastebin.com/w396Xxi4
>
> A document in this test app has a window and a text field, the user enters text in the text field, that text is the "state" of the document. The app saves and loads that text.
>
> I'm saving the data using dataOfType: error: and loading the data using readFromData: ofType: error:. The user interface (the text field in particular) is being updated after being loaded in windowControllerDidLoadNib: unless the data is being reverted, in which instead the user interface is being updated in readFromData: ofType: error: (to test if a document is being reverted, I check if an outlet such as the textField != nil)
>
> Now, the saving of the document works fine. Browsing and choosing a different saved version of the document also works fine. What doesn't work correctly is reverting to another version. For example, if I create a new document, save the document, make a change (entering something new in the text field and hitting enter), choose revert to last saved version from the window titlebar, and save again, I occasionally get an error message "This document's file has been changed by another application since you opened or saved it." or I get "The location of the document ----- cannot be determined." (I say occasionally because I cannot get it to error the first attempt I do this while a document is still open, but usually always get an error on my second, and further attempts). I can also reproduce this error when trying to save after choosing a different version in the versions browser, however, I think I can only reproduce the error in this case when my document is in an edited state before trying to choose another version (If I save before trying to choose a different version and then save after, I don't get get an error).
>
> Here's a couple images of the errors:
> http://dl.dropbox.com/u/10108199/error1.png
> http://dl.dropbox.com/u/10108199/error2.png
>
> Also, is there a better approach to loading a reverted document than what I'm doing (instead of testing if an outlet of a document is nil)? Any help would be appreciated.
>
> Thanks,
> -Zorg:-._______________________________________________
>
> 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