centralManagerDidUpdateState returns power off iOS

2019-04-11 23:13发布

问题:

I'm working with CoreBluetooth and I'm using CBCentralManager and its delegates. But the problem is that when I run my code in iOS 11-Beta 4 I get power off state in delegate - (void)centralManagerDidUpdateState:(CBCentralManager *)central while bluetooth is ON.

When I turn bluetooth off and then turn it back to on, it returns power on. Also it is working fine in iOS 10 and 9. The peripheral is working fine too and it is discoverable using LightBlue application in iOS 11-Beta 4. I'm not sure why it's happening.

回答1:

It looks like bug there, check the bug report here:

https://bugreport.apple.com/web/?problemID=33728133

Also stated that:

iOS 11 is in general going to be less forgiving for apps which don't hold a proper reference to CB objects even if the problem described here becomes less severe. So, the best is to manage object life cycles properly.

Also, advised to update and check with Beta 5.

Check the complete thread here for more info:

iOS 11 - CoreBluetooth Broken If Using State Presevation and Peripheral Not Cancelled Properly