Tells your delegate to save any high-level state information at the beginning of the state preservation process.
- iOS 6.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Your singleton app object.
The keyed archiver in which to write any state information.
The state preservation system calls this method at the beginning of the preservation process. This is your opportunity to add any app-level information to state information. For example, you might use this method to write version information or the high-level configuration of your app.
Your implementation of this method can encode restorable view and view controller objects that it needs to reference. Encoding a restorable view or view controller writes that object’s restoration identifier to the coder. (That identifier is used during the decode process to locate the new version of the object.) If the view or view controller defines a
encode method, that method is also called at some point so that the object can encode its own state.
Apart from views and view controllers, other objects follow the normal serialization process and must adopt the
NSCoding protocol before they can be encoded. Encoding such objects embeds the object’s contents in the archive directly. During the decode process, a new object is created and initialized with the data from the archive.