Lee Irvine
Lee Irvine

Reputation: 3347

CBCentralManager -- willRestore -- CBCentralManagerRestoredStateScanServicesKey

When restoring state with CBCentralManager the dictionary sometimes contains a scanned peripheral's UUID

internal func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
    let scannedPeripherals = dict[CBCentralManagerRestoredStateScanServicesKey] as? [CBUUID]
}

In contrast to willRestoreState, didDiscoverPeripheral provides CBPeripheral objects that the Central Manager can connect with.

My question is, what can I do with the UUID? The Central Manager can't connect or detect the device when this happens.

Upvotes: 0

Views: 192

Answers (1)

Paulw11
Paulw11

Reputation: 114773

Since the peripheral has already been discovered you don't need to scan for it.

You can pass the identifier to retrievePeripherals(withIdentifiers): in order to obtain a CBPeripheral instance that you can connect to.

Upvotes: 1

Related Questions