Using NSKeyedArchiver to save and restore state on iPhone apps
Using NSKeyedArchiver to save and restore state on iPhone apps
- Subject: Using NSKeyedArchiver to save and restore state on iPhone apps
- From: Jason Bobier <email@hidden>
- Date: Wed, 10 Feb 2010 13:40:56 -0500
As many of you know, saving and restoring complex navigation hierarchies on the iPhone can be a real chore. So, I had this brilliant idea of setting up my app delegate like this:
applicationDidFinishLaunching
if userdefaults contains an archived navcontroller
unarchive controller and retain
else
load nib with controller and retain
add navcontroller view to window
applicationWillTerminate
archive nav controller and save to user defaults
and then make all of my view controllers NSCoding compliant
In theory, the archived navcontroller should contain my complex view controller hierarchy and all of the related views, so this should work.
However, when I unarchive and add to view to the window, the subviews rarely have all of their values set correctly despite being supposedly NSCoding compliant. (For example, I have a button that fails to have it's target and action set)
Am I missing something here or is this just buggy NSCoding compliant code on apple's part?
Thanks,
Jason
_______________________________________________
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