Preventing lion from saving state...
Preventing lion from saving state...
- Subject: Preventing lion from saving state...
- From: Matthew Weinstein <email@hidden>
- Date: Tue, 23 Aug 2011 11:25:27 -0700
My approach has landed up being just as kludgy, and I'm really annoyed that apple has made no way to opt out of this "feature." I have basically gone in (in the applicationWillFinishLaunching app delegate notification) and emptied and locked the saveState folder for just my application in the ~/Library folder of the user to prevent this nonsense. Once locked the program behaves normally.
NSApp delegate needs to simply have a -(BOOL) saveProgramState option (Apple, are you out there?)
It seems to have taken care of the issue.
On Aug 23, 2011, at 11:03 AM, Sean McBride wrote:
> 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];
> }
>
_______________________________________________
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