Re: Preventing lion from saving state...
Re: Preventing lion from saving state...
- Subject: Re: Preventing lion from saving state...
- From: Sean McBride <email@hidden>
- Date: Wed, 24 Aug 2011 11:08:19 -0400
- Organization: Rogue Research Inc.
On Wed, 24 Aug 2011 08:56:49 +1000, Graham Cox said:
>In Xcode 4, you can configure your scheme to have "disable state
>restoration" checked. This suggests that there is a switch that can be
>set that turns this off for an app, either as a defaults setting or
>maybe as a command-line argument. Unfortunately I can't see exactly how
>that works, but when the app launches, the log shows:
>
>23/08/11 1:12:19.951 PM Artboard: ApplePersistenceIgnoreState: Existing
>state will not be touched. New state will be written to /var/folders/_d/
>fcb3h3892y339vh632v_hz280000gn/T/com.mapdiva.as.Artboard.savedState
>
>
>So perhaps 'ApplePersistenceIgnoreState' is a simple boolean in your
>defaults that can be set? Worth a try…
You can use it with Xcode 3 too, just pass it as a command line argument with value YES to your executable. But it's not something you should ship with, it's for debugging.
Only windows associated with an NSDocument are restorable by default. It's much safer, as I described before, to just do:
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];
}
every time you add a window to your document.
If you can require Xcode 4.1, you can also turn off the 'restorable' bool in IB's inspector for your document windows. But this may make your nibs not work with older tools, I'm not sure. I need to edit my nibs on 10.5, and so didn't go that route.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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