DrMickeyLauer
DrMickeyLauer

Reputation: 4674

CoreBluetooth `retrieveConnectedPeripheralsWithServices` returns disconnected peripherals

I wonder about the semantics of CBManager's retrieveConnectedPeripheralsWithServices. Everytime I'm using this I get CBPeripheral instances back with state CBPeripheralStateDisconnected.

It's not a problem to connect again, but isn't this method supposed to return connected peripherals?

Upvotes: 1

Views: 688

Answers (1)

Jens Meder
Jens Meder

Reputation: 4367

Unfortunately, this is intended behaviour. It is a bit counterintuitive I have to admit but the peripheral state is always related to your app. That means if you have connected/paired/bonded the peripheral using another app or via the bluetooth system settings, it will still show as disconnected within your app. If you have connected some peripherals within your app they will show as connected.

Upvotes: 1

Related Questions