为什么我CBCentralManagerStateUnknown
在使用这个简单的代码时会使用 iPad 2?
- (BOOL)viewDidLoad {
bluetoothManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
if ([manager state] == CBCentralManagerStatePoweredOff) NSLog(@"CBCentralManagerStatePoweredOff");
if ([manager state] == CBCentralManagerStatePoweredOn) NSLog(@"CBCentralManagerStatePoweredOn");
if ([manager state] == CBCentralManagerStateResetting) NSLog(@"CBCentralManagerStateResetting");
if ([manager state] == CBCentralManagerStateUnauthorized) NSLog(@"CBCentralManagerStateUnauthorized");
if ([manager state] == CBCentralManagerStateUnknown) NSLog(@"CBCentralManagerStateUnknown");
if ([manager state] == CBCentralManagerStateUnsupported) NSLog(@"CBCentralManagerStateUnsupported");
}
我无法弄清楚是什么CBCentralManagerStateUnknown
意思。我该怎么办?苹果文档只是说:
状态未知,即将更新。
我在连接蓝牙设备时收到此响应,并且在蓝牙关闭时也收到此响应。如果我尝试运行类似的东西[manager retrieveConnectedPeripherals]
,我也会在控制台中收到此消息:
CoreBluetooth[WARNING] <CBConcreteCentralManager: ...> is not powered on