nickoneill / PermissionScope

Intelligent iOS permissions UI and unified API
MIT License
4.84k stars 506 forks source link

Don't start/stop Bluetooth advertising if powered off #107

Open cgst opened 8 years ago

cgst commented 8 years ago

Attempting to

bluetoothManager.startAdvertising(nil)
bluetoothManager.stopAdvertising()

in triggerBluetoothStatusUpdate() outputs an error message on the iOS system console:

[CoreBluetooth] API MISUSE: <CBPeripheralManager: 0x15f1fb1a0> can only accept this command while in the powered on state

nickoneill commented 8 years ago

This is only called if the peripheral state is Unknown which is exclusive of knowing if the peripheral is on/off. I don't see a huge issue here other than the error message, so punting this until we refactor bluetooth to pending status in #113.