I see, so it’s the OS that’s broadcasting the peripheral, and it’s when I request a read of the characteristic that the restoration is made.
So the restoration might not be happening.
I just tested again, and on first scan it read the characteristic fine with this log:
Nov 9 11:06:25 Scotts-iPad BTLEServer[699] <Notice>: (Note ) Starting XPC server
Nov 9 11:06:25 Scotts-iPad BTLEServer[699] <Notice>: (Note ) PeripheralManager state is now powered on
Nov 9 11:06:25 Scotts-iPad BTLEServer[699] <Notice>: (Note ) Service "Unknown (<7905f431 b5ce4e99 a40f4b1e 122d00d0>)" has been published
Nov 9 11:06:25 Scotts-iPad BTLEServer[699] <Notice>: (Note ) Service "Battery" has been published
Nov 9 11:06:25 Scotts-iPad BTLEServer[699] <Notice>: (Note ) Service "Current Time" has been published
Nov 9 11:06:26 Scotts-iPad kernel[0] <Debug>: launchd[700] Container: /private/var/mobile/Applications/73A0C970-7697-41A9-AA68-9BB5CB9A83D5 (sandbox)
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: -[BTViewController viewDidLoad]
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: -[BTViewController peripheralManager:willRestoreState:]
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: -[BTViewController peripheralManagerDidUpdateState:]
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: -[BTViewController peripheralManager:didReceiveReadRequest:]
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: mainString:Scott
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: request.value:<53636f74 74>
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: Added Service
Nov 9 11:06:26 Scotts-iPad Bluetooth-Test[700] <Warning>: Error publishing service: Unknown error.
A second scan resulted in finding the peripheral, connecting to it, attempting to read the characteristic, but no logs whatsoever showing on the peripheral side and the unknown error as before.
Is there any boilerplate background peripheral code anywhere I can take a look at to double check that mine’s ok.
I’m using my sons iPad mini with 2 games called Gunner Z & Zombie Cafe that happily use all the memory and kill all apps after the intro videos are run.
I wonder if it’s possible to make a small app that just leaks all memory to kill all backgrounded apps?