I am working on an app that reacts on disconnects of peripherals and I am now trying to adopt the ne state preservation and restoration introduced in iOS 7.
I did everything like the documentation says, means:
I added the background mode for centrals.
I always instantiate my central manager with the same unique identifier.
I implemented the
centralManager:willRestoreState:
method.
When my App moves to background I kill it in the AppDelegate callback with an kill(getpid(), SIGKILL);
. (Core Bluetooth State Preservation and Restoration Not Working, Can't relaunch app into background)
When I now disconnect a peripheral by removing the battery my app is being waked up as expected and launchOptions[UIApplicationLaunchOptionsBluetoothCentralsKey]
contains the correct identifier BUT the centralManager:willRestoreState:
was not called.
Only if I disconnect another peripheral this method gets called.
This is how I have it:
And then: