Hello dear Apple Platform Engineers,
I'm working on an iOS App that connects to a Bluetooth Low Energy Peripheral in the foreground. Whenever the App moves into Background, we want to continue syncing data & therefore implemented State Restoration to be informed about Discovery, Connect, Disconnect or Characteristic changes in the Background in order to wake the App up whenever it was "Terminated due to memory issue".
I consulted https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW1
for this & assigned:
CBCentralManagerOptionRestoreIdentifierKey
Reinstantiate the dedicated CentralManager &
implemented the centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) Delegate
Additionally, I assigned the following keys on
connect(_ peripheral: CBPeripheral, options: [String : Any]? = nil)
CBConnectPeripheralOptionNotifyOnConnectionKey
CBConnectPeripheralOptionNotifyOnDisconnectionKey
CBConnectPeripheralOptionNotifyOnNotificationKey
However, from my experience the App gets woken up, but neither the willRestoreState nor the didDiscover, didConnect or didDisconnectPeripheral is called even though
launchOptions?[UIApplication.LaunchOptionsKey.bluetoothCentrals] as? [String] is not empty.
What might I be missing when trying to make this approach work? Thanks a lot for any insights & support!
2
0
49