I am using bluetooth in my app to work with iBeacons (Location Services)
Since iOS11, and the new functionality brought in Control Center, my bluetooth prompts don't show when turning bluetooth off via Control Center
.
But when I turn bluetooth off in the Settings App
, the prompt does appear.
I'm setting CBCentralManagerOptionShowPowerAlertKey
to be YES
.
Here is the code where I'm initialising the CBCentralManager
:
_bluetoothManager =[[CBCentralManager alloc]
initWithDelegate:self
queue:dispatch_get_main_queue()
options:@{CBCentralManagerOptionShowPowerAlertKey: @(YES)}];
When getting the bluetooth state from centralManagerDidUpdateState:(CBCentralManager *)central
, I'm getting the same OFF state when turning bluetooth off from both the Settings App
and Control Center.
But the prompt only appears when turning off via Settings
.
How can I get the "Turn on Bluetooth" prompt to work when turning Bluetooth off via Control Center?
The only workaround that I can think of is to set CBCentralManagerOptionShowPowerAlertKey
to be NO
and then create a custom dialog to open the Settings App
. It's not possible to open direct to the bluetooth settings page on iOS 11.