2014-11-05 33 views
0

CentralManager不會在後臺掃描BLE裝置....IOS BLE scanForPeripheralsWithServices:選擇:在背景

我已經設置UIBackgroundModesbluetooth-central在info.plist中。

還試圖輸入UUID爲服務這樣的..

[CentralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"0xFFA0"]] options:nil]; 

(0xFFA0爲服務的UUID。)

還試圖"C337FA9-4DCF-****-77AB-************"; UUID爲設備。 無論我把UUID放在服務中。在後臺找不到任何設備。

當前臺.. scanForPeripheralsWithServices:nil找到所有設備。 但不是scanForPeripheralsWithServices:someuuids

任何人都可以幫助我嗎?

+0

你是否嘗試用一些uuid掃描scanForPeripheralsWithServices?並且在這種情況下在前景中獲得一些結果嗎? – Leo 2014-11-05 09:06:07

+0

不,我沒有得到任何設備,當它在前臺掃描一些uuid。 – Sean 2014-11-06 04:47:00

回答

1

1.如果您使用

scanForPeripheralsWithServices:someuuids 

必須有一些設備通告本uuids.This藍牙數據包可以同時在前臺工作良好,backgournd

2,如果你使用

scanForPeripheralsWithServices:nil 

你可以得到你想要的所有設備,但是這在後臺不起作用。

所以,如果你想在後臺得到結果,你必須設置你的外設使用UUID通告BLE數據包。