Re: Cancelling state restoration on iOS
Re: Cancelling state restoration on iOS
- Subject: Re: Cancelling state restoration on iOS
- From: Steve Mills <email@hidden>
- Date: Tue, 25 Jul 2017 23:29:20 -0500
On Jul 25, 2017, at 22:28:19, Sixten Otto <email@hidden> wrote:
>
> You can set a custom restorationClass on a per view controller basis,
> passing the process of instantiating the controller during restoration
> through your own code that knows how to check whether the document is still
> there. (We do something similar in our app in some places to make sure that
> our Core Data store is present, and contains the objects the stored state
> had been displaying.)
>
> https://developer.apple.com/documentation/uikit/uiviewcontroller/1621472-restorationclass
>
> (It is true, though, that this cannot abort the *entire* restoration
> process. Just prune sub-trees of the view controller graph.)
Close enough. The documentation for this is horribly vague. I made my VC
inherit UIViewControllerRestoration and implemented
viewControllerWithRestorationIdentifierPath:coder:, returning nil of the file
is no longer available. Where things get confusing is the whole
restorationClass property and how to implement it. I did what many suggest of
setting it to my VC's class in the init or viewDidLoad method. But if I do NOT
do that, everything still works correctly.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
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