Dose CoreBluetooth work on IOS6.0,IOS6.1,IOS6.1.2?

允我心安 提交于 2019-12-24 02:25:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!