With iOS 6, Apple added recovery status to the UIViewController and related classes. This allows the application to maintain state upon completion and restore it when the user resumes the application.
Everything seems to be working fine, however, I reached a strange scenario that doesn't want to fit into the template.
Suppose we have two view controllers, ViewControllerOne and ViewControllerTwo , both of which retain some kind of arbitrary state that was successfully restored. Now imagine that ViewControllerOne has a delegate property and that ViewControllerTwo is a delegate (which is a common template for modal view controllers). Who is responsible for restoring this relationship? And how should it be saved / restored?
In my particular case, storyboards are not involved; restoration occurs in the code through the restorationClass property. My first instinct was to try to restore relations when creating a view controller in restClass, however, since restorationClass has no idea about other existing controllers, it cannot completely restore such relations.
Alternatively, if this is a view controller that declares a delegate property that should restore communication, then how does this happen with a controller instance that was restored in some other class?
In short, this seems like a poorly documented scenario, and I was hoping someone could shed some light on it.
source share