On Mon, 22 Aug 2011 12:39:01 -0700, Matthew Weinstein said:

>I'm working on updating my app for lion. For the time being, just to get
>users able to proceed I need to disable Lion's restore savedstate
>default. I don't want Lion opening any windows (other than the ones I
>open programmatically) when a user starts the program. I can't find how
>to do that in the api for NSApp, am I missing something? I need the
>program to force this condition, rather than leave it to users (I did
>find a way users can turn off this feature).

Apple has not made this easy, despite the fact that this new Resume feature 
causes binary incompatibility with several applications.

In my case, I made a wrapper around NSDocument's addWindowController: that adds 
this:

                NSWindow* window = [inControllerToAdd window];
                if ([window respondsToSelector:@selector(setRestorationClass:)] 
&&
                        [window respondsToSelector:@selector(setRestorable:)] &&
                        [window 
respondsToSelector:@selector(invalidateRestorableState)])
                {
                        [window setRestorationClass:Nil];
                        [window setRestorable:NO];
                        [window invalidateRestorableState];
                }

--
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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