To make this clear up front: This bug report is not about the new behavior of the control center. Even though the bug is probably related.
Environment:
iOS 11.0.3 & 11.1.2
iPhone 7 & iPhone X
Bug Report:
- The state of the central manager is sometimes reported as CBManagerStatePoweredOff even though Bluetooth is shown as turned on in the control center and the settings
- The wrong state is not restricted to one app but affects all apps that are using CoreBluetooth
- We weren't able to connect to our device (when ignoring the reported off state)
- This issue appeared multiple times in our office alone, so we assume it to be quite widespread
- Toggling Bluetooth resolved the issue
- Restarting apps had no effect
- We had the feeling it is related to toggling the airplane mode — at least that's how we managed to reproduce it
Analysis:
I retrieved a sysdiagnose file after one occurrence. These are the steps I took:
- I played around with turning Bluetooth and the airplane mode on and off
- I wasn't able to reproduce the issue and locked the device
- Sometime later I installed our app via Xcode and the issue manifested. That's when I triggered sysdiagnose
Here you see some depicted log entries that seemed relevant to me. Unfortunately, I haven't found the logs about changing the state of the Bluetooth toggle. But I can provide the full sysdiagnose archive upon request.
default 2017-11-28 17:04:39.882932 +0100 symptomsd-helper AirplaneMode OFF, Wi-Fi administratively ON, Cellular data switch administratively ON, RNF administratively ON
debug 2017-11-28 17:13:34.625110 +0100 OUR-APP Sending XPC message 1: {
kCBMsgArgName = "our.bundle.identifier";
kCBMsgArgOptions = {
kCBInitOptionShowPowerAlert = 0;
};
kCBMsgArgType = 0;
kCBMsgArgVersion = 20161219;
}
default 2017-11-28 17:13:34.626054 +0100 bluetoothd Access level is less than kXPCAccessLevelSystem for session "our.bundle.identifier-central-4454-269". Restricted state operation not allowed
default 2017-11-28 17:13:34.626901 +0100 bluetoothd Registering central session "our.bundle.identifier-central-4454-269" with backgrounding: on, persistence: off
default 2017-11-28 17:13:34.627434 +0100 bluetoothd Session "our.bundle.identifier-central-4454-269" : needsRestrictedStateOperation = 0, overrideRestrictedState = 0 , blacklistMode = 1
default 2017-11-28 17:13:34.627438 +0100 bluetoothd Sending 'state updated' event with state "Off" to session "our.bundle.identifier-central-4454-269"
default 2017-11-28 17:13:34.775454 +0100 bluetoothd Received XPC message "CBMsgIdRetrievePeripheralsWithIdentifiers" from session "our.bundle.identifier-central-4454-269"
error 2017-11-28 17:13:34.775457 +0100 bluetoothd Ignoring XPC message as state is "Off"
default 2017-11-28 17:13:52.513918 +0100 sysdiagnose request: sysdiagnose (stackshot only) keychord: Power + Volume Up