State Preservation and Restoration Because state preservation and restoration is built in to Core Bluetooth, your app can opt in to this feature to ask the system to preserve the state of your app’s central and peripheral managers and to continue performing certain Bluetooth-related tasks on their behalf, even when your app is no longer running. When one of these tasks completes, the system relaunches your app into the background and gives your app the opportunity to restore its state and to handle the event appropriately. In the case of the home security app described above, the system would monitor the connection request, and re-relaunch the app to handle the centralManager:didConnectPeripheral: delegate callback when the user returned home and the connection request completed.
How can I trigger this and test the code?
I have got an accessory with a service. I have got an app that scans for the service and I opted in state preservation. However I am not sure how to logically test it as I do not know what I need to trigger it. These are the options that I tried unsuccessfully:
A - kill the app from Xcode
B - kill the app manually
C - power off the phone
D - something else
In all these options I tried to go to Xcode -> device and look at the logs, but haven't seen any state restoration logs.
Thanks