0
有沒有辦法判斷CBCentralManager
是否忙於做scanForPeripheralsWithServices
?我試圖看看狀態,但似乎沒有表明它正在忙於掃描。如何判斷CBCentralManager是否仍在處理scanForPeripheralsWithServices?
有沒有辦法判斷CBCentralManager
是否忙於做scanForPeripheralsWithServices
?我試圖看看狀態,但似乎沒有表明它正在忙於掃描。如何判斷CBCentralManager是否仍在處理scanForPeripheralsWithServices?
CBCentralManager
沒有財產,表明它是否正在掃描外圍設備。你需要自己跟蹤這個。
通常你會在一個類中實現你的藍牙功能,你可以添加一個布爾屬性到這個類,當你調用scanForPeripheralsWithServices
時你設置爲true,當你調用stopScan
時你設置爲false。
還有一個如何在[RFduino iOS代碼回購](https://github.com/RFduino/RFduino)中實現這個不太糟糕的例子。 –