Hi all-

I’m working on a document-based app and making every effort to adopt the 
behaviors of a modern app.  This includes state restoration, described in the 
current documentation at:

https://developer.apple.com/library/mac/documentation/General/Conceptual/MOSXAppProgrammingGuide/CoreAppDesign/CoreAppDesign.html#//apple_ref/doc/uid/TP40010543-CH3-SW14

Despite my best efforts, I’m not having any success with any actual 
“restoration”… I’ve never seen any evidence of the system attempting to call 
the relevant overrides when launching my app, after leaving documents open 
during a quit or log out.  Here’s what I know:

- document windows have a restoration identifier.
- document windows are set to be restorable.
- document windows are confirmed to have a restoration class of my custom 
NSDocumenController subclass (made solely to catch the calling of 
restoreWindowWithIdentifier:state:completionHandler:).  If I don’t subclass, 
they are confirmed to have a restoration class of NSDocumentController.
- I’ve adopted automatic termination by setting the correct Info.plist entry.

What works:

I can see encodeRestorableStateWithCoder: being called on my window and on view 
subclasses that I want to restore state for.

What does not work:

I never see a corresponding restoreStateWithCoder: get called on the window or 
views, nor do any of the NSWindowRestoration overrides get called…

no restoreWindowWithIdentifier:state:completionHandler: on custom 
NSDocumentController
no restoreDocumentWindowWithIdentifier:state:completionHandler: on custom 
NSDocument

I’ve Googled extensively; there’s so little on the topic that I’m wondering if 
developers are actively adopting this feature.  Does anyone have an app that 
works properly with state restoration, or have a few snippets or ideas to 
share?  

Any help is much appreciated - thanks!

John
_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to