The question could be duplicated, but I have tried a lot of code and it wasn't work. I have read about
CBCentralManagerOptionShowPowerAlertKey
option and the possibility to show an alert to go settings bluetooth option into iPhone for turn on on the application, but I haven't get works this.
If I set the key to true the key not appear, and when I change the value to false the key not works...
I'm using this code into my Swift application:
var bCentralManger: CBCentralManager!
self.bCentralManger = CBCentralManager(delegate: self, queue: DispatchQueue.main, options: [CBCentralManagerOptionShowPowerAlertKey: true])
Works this option in iOS? I'm using iOS 12 on my device. Have anybody this code working? Thanks!
答案 0 :(得分:0)
仅当从 Settings 应用程序关闭了Bluetooth时,才会显示Bluetooth电源警报。如果仅从控制中心禁用蓝牙,则不会显示该对话框。从控制中心禁用蓝牙会断开所有连接的外围设备的连接,但不能完全关闭蓝牙硬件的电源。
您可以在.poweredOff
委托方法中显示自己的警报以响应centralManagerDidUpdateState
状态。不幸的是,在这种情况下,您无法直接将用户发送到蓝牙设置。
您可以就此行为向Apple记录Radar,但我怀疑他们会回答该系统按预期运行。