• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to make Lion's autosaving work for my application?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to make Lion's autosaving work for my application?


  • Subject: How to make Lion's autosaving work for my application?
  • From: Nick <email@hidden>
  • Date: Sat, 01 Oct 2011 23:56:18 +0300

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 (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

  • Follow-Ups:
    • Re: How to make Lion's autosaving work for my application?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: combining two entities to one binding
  • Next by Date: Re: How to make Lion's autosaving work for my application?
  • Previous by thread: Re: combining two entities to one binding
  • Next by thread: Re: How to make Lion's autosaving work for my application?
  • Index(es):
    • Date
    • Thread