Opting In to State Restoration

State restoration is disabled by default in applications. To enable state restoration, you must opt in within the application delegate.

Open BNRAppDelegate.m and implement the two delegate methods to enable state saving and restoration.

@​i​m​p​l​e​m​e​n​t​a​t​i​o​n​ ​B​N​R​A​p​p​D​e​l​e​g​a​t​e​

-​ ​(​B​O​O​L​)​a​p​p​l​i​c​a​t​i​o​n​:​(​U​I​A​p​p​l​i​c​a​t​i​o​n​ ​*​)​a​p​p​l​i​c​a​t​i​o​n​
 ​ ​ ​ ​ ​ ​ ​ ​s​h​o​u​l​d​S​a​v​e​A​p​p​l​i​c​a​t​i​o​n​S​t​a​t​e​:​(​N​S​C​o​d​e​r​ ​*​)​c​o​d​e​r​
{​
 ​ ​ ​ ​r​e​t​u​r​n​ ​Y​E​S​;​
}​

-​ ​(​B​O​O​L​)​a​p​p​l​i​c​a​t​i​o​n​:​(​U​I​A​p​p​l​i​c​a​t​i​o​n​ ​*​)​a​p​p​l​i​c​a​t​i​o​n​
 ​ ​ ​ ​ ​ ​ ​ ​s​h​o​u​l​d​R​e​s​t​o​r​e​A​p​p​l​i​c​a​t​i​o​n​S​t​a​t​e​:​(​N​S​C​o​d​e​r​ ​*​)​c​o​d​e​r​
{​
 ​ ​ ​ ​r​e​t​u​r​n​ ​Y​E​S​;​
}​

When the application goes into the background, its state will attempt to be saved, and if the app is launching fresh, its save will attempt to be restored. To understand what gets stored, we need to discuss restoration identifiers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset