I have an NSDocument based app with a simple NSTextView, and I'd like to
have all my windows opened and text loaded into NSTextView when the app is
launched as it was before closing the application (just like Text Edit
does).

How can I do the same in my application?

Currently I am using

- (void)window:(NSWindow *)window didDecodeRestorableState:(NSCoder *)state

and

- (void)window:(NSWindow *)window willEncodeRestorableState:(NSCoder *)state


and I am "encoding"/"decoding" the textview's contents, but I need to encode
NSDocument's fileURL, the "dirtiness" of the document and other information
together with the document's contents. I was hoping this Autosave feature
could help me do it easier. But i don't know how to turn it on.

What I did is defined in my NSDocument's subclass method:
+ (BOOL)autosavesInPlace {
    return YES;
}

but apparently this is not enough, since I get my document's NSTextViews
empty when the app is launched next time after it's been quit with filled
text views and lots of opened documents.

Can you please help me?
Thank you!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to