2013-03-12 24 views
2

我正在使用bluetooth4.0,但是我發現CoreblueTooth不能在iOS 6 +上運行,我的iphone4s是IOS 6.1.2。劑量CoreBluetooth工作在IOS6.0,IOS6.1,IOS6.1.2?

無法找到任何設備(我相信在設備上電),日誌爲每次如下:

CoreBluetooth [警告]沒有開機

劑量任何人都遇到這個問題?

+1

警告消息告訴您的藍牙無線電的iPhone不在。它並沒有告訴你你的外設已經關閉。您需要發佈您用於設置和使用藍牙的代碼。 – mttrb 2013-03-12 09:27:20

+0

mbuc91有一個更詳細的答案,但是爲了迴應你的基本問題:是的,Core Bluetooth可以在iPhone 4S上的所有iOS版本上運行。我用它來與每個版本的附件進行通信。有些奇怪的錯誤會導致從外設返回空的UUID,但是即使在那裏,設備本身也可以很好地發現。 – 2013-03-15 18:31:01

回答

0

我在運行6.0.1的iPhone 4S上進行測試。 iPhone處於核心地位,我沒有看到你的警告。

您能否更具體地說明您在做什麼? - 你在外圍或中心角色?

您是否已經初始化CBCentralManager(如果您是中心的),如下所示?

centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()]; 

我希望我可以幫你

3

狀態CBCentralManagerStatePoweredOn不僅啓用藍牙功能,而且還您CBCentralManager或CBPeripheralManager的情況下就可以使用了手段。您需要必須初始化您的經理,然後等待其狀態更改使用之前。例如,如果您作爲一箇中央,你會用下列初始化:

centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; 

並實現委託方法centralManagerDidUpdateState:

- (void)centralManagerDidUpdateState:(CBCentralManager *)central 
{ 
    if (central.state == CBCentralManagerPoweredOn) 
    { 
     //do your stuff, it's ready 
    } 
}