I am working on a BLE project, for that I initiate CBCentralManager, and scan for available devices. I am able to scan and connect with available BLE peripheral device.
Everything is working fine till I have not tested this on iOS 11.0.x version.
when I tested on iOS 11.1.1 or 11.1.2, CBCentralManager always return me poweredOff state, when launch app. But when I open control center, and turn off and turn on bluetooth again or activate/deactivate FlightMode (automatically turn off/on bluetooth). App start scanning BLE peripherals and everything looks fine, till restart on app.
Does anyone faced such issue on iOS 11.1.x and able to fix this,Please help to fix this.
Below is my code to check status
func initiateCentralManager(){
manager = CBCentralManager(delegate: self, queue: nil, options: [CBCentralManagerOptionRestoreIdentifierKey : "MyBLECurrentState"])
}
func centralManagerDidUpdateState(_ central: CBCentralManager){
print("Received CBCentralManager state")
peripheralArray.removeAll()
if central.state == .poweredOn {
print("poweredOn")
} else if central.state == .poweredOff {
print("poweredOff")
}
}