Hi all,
Has anyone else run into issues with CBPeripheralManager State Restoration on the iOS 11 Betas so far? I filed bug report (https://bugreport.apple.com/web/?problemID=34168225)for the below but has anyone else come across similar issues? I can see several reports of issues for CBCentralManager state restoration which I believe is now fixed but none for CBPeripheralManager restoration.
Thanks
Bug Report
On iOS11 Beta 8 - CBPeripheralManager State Restoration appears to be broken. In scenarios where an app should be relaunched in the background to allow for CBPeripheralManager restoration this does not occur. didFinishLaunchingWithOptions is not called unlike the same scenario on iOS 10.3.3 and earlier versions of iOS.
Steps to Reproduce:
1. On iPhone 1 create a CBPeripheralManager that is background enabled.
2. Create a service and some characteristics and startAdvertising these on the peripheral.
3. Background the app
4. Open other apps on iPhone 1 until the app is 'Terminated due to memory pressure'
5. From another device (iPhone 2) scan for the peripheral and connect.
Expected Results: On iPhone 1 in the device logs the terminated app should be relaunched in the background and this callback fired allowing for the PeripheralManager to be restored correctly.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSArray *peripheralManagerIdentifiers = launchOptions[UIApplicationLaunchOptionsBluetoothPeripheralsKey];
if ([peripheralManagerIdentifiers count] > 0) {
for (NSString *peripheralManagerID in peripheralManagerIdentifiers) { /
// Check IDs and restore Peripheral Manager if appropriate
}
}
}
Observed Results: Viewing iPhone 1 device logs the terminated app is not relaunched when iPhone 2 connects and didFinishLaunchingWithOptions is never called so it is impossible to restore the PeripheralManager and handle events as in iOS 10 and earlier versions of iOS