问题
i am working on bluetooth4.0 , but i found that CoreblueTooth cannot run on iOS 6+,my iphone4s is IOS 6.1.2.
it cannot find any device(i am sure the device is power on), the Log as below every time:
CoreBluetooth[WARNING] is not powered on
Dose anyone have encounter this issue?
回答1:
The status CBCentralManagerStatePoweredOn means not only that Bluetooth is turned on, but also that your instance of CBCentralManager or CBPeripheralManager is ready to use. You must initialize your manager, then wait for its state to change before using it. For example, if you are acting as a Central, you would initialize it with the following:
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
And implement the delegate method centralManagerDidUpdateState:
- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
if (central.state == CBCentralManagerPoweredOn)
{
//do your stuff, it's ready
}
}
回答2:
I'm testing on a iPhone 4S running 6.0.1. The iPhone is in central role and I don't see your warning.
Can you please be more specific about what you're doing? - Are you in peripheral or central role?
Have you initialized the CBCentralManager (if you're a central) as follows?
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()];
I hope I could help you
来源:https://stackoverflow.com/questions/15354956/dose-corebluetooth-work-on-ios6-0-ios6-1-ios6-1-2