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.) On Tue, Jul 25, 2017 at 12:50 PM, Steve Mills <sjmi...@mac.com> wrote: > There doesn't appear to be any way to cancel state restoration other than > from the app delegate method application:shouldRestoreApplicationState:. > So if it's trying to restore a view controller for a document that is no > longer available on the device, I want to cancel the whole restoration. The > only object that knows which document was previously open is the view > controller that displays the document. But the only methods offered for > decoding a VC's state is decodeRestorationStateWithCoder:, which doesn't > return anything like a BOOL to say if it could be restored or not. > > Any ideas? > > -- > Steve Mills > Drummer, Mac geek > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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/himself%40sfko.com > > This email sent to hims...@sfko.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com