'What causes this iOS permission prompt for "use Bluetooth for new connections"?
Solution 1:[1]
I am somewhat sure that this second prompt is a new iOS13 variation on "please enable Bluetooth" and that it appears because:
- We created CBCentralManager without the CBCentralManagerOptionShowPowerAlertKey=false
- The user has set Bluetooth to "off" in the control centre, but not turned Bluetooth fully off in Settings.
The description of "use Bluetooth for new connections" seems to correspond to the "fully enabled" state, while the "partially enabled" white button in control centre means getting this prompt.
Solution 2:[2]
Swift 5 / To disable "APP_NAME would like to use Bluetooth for new connections" alert use options when instantiating CBCentralManager:
var centralManager = CBCentralManager(delegate: YOUR_DELEGATE?, queue: YOUR_QUEUE?, options: [CBCentralManagerOptionShowPowerAlertKey: 0])
Solution 3:[3]
By default, when Bluetooth is disabled every time you create a CBCentralManager
this pop-up will appear.
If you add a CBCentralManagerOptionShowPowerAlertKey to the options
when creating your CBCentralManager
this pop-up will not appear.
Swift:
let manager = CBCentralManager(delegate: nil,
queue: nil,
options: ["CBCentralManagerOptionShowPowerAlertKey": 0])
Objective-C:
[[CBCentralManager alloc] initWithDelegate:self
queue:nil
options:@{CBCentralManagerOptionShowPowerAlertKey: @0}];
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | |
Solution 3 | spnkr |