didDiscover peripheral not called

后端 未结 1 1191
旧时难觅i
旧时难觅i 2021-01-28 22:48

I want to use the CBCentralManager in order to find the bluetooth low energy peripherals around me. The centralManager is getting initiated, it starts correctly and it is scanni

相关标签:
1条回答
  • 2021-01-28 23:16

    optional func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) is a CBCentralManagerDelegate method.

    Your class SmallerBeaconServiceImpl is compliant with CBCentralManagerDelegate, but you didn't set your centralManager delegate (CBCentralManagerDelegate) property. That's why centralManager(_central:didDiscover:advertisementData:rssi) is not called.

    This can be fixed with:

    centralManager = CBCentralManager(delegate: self, queue: nil)
    
    0 讨论(0)
提交回复
热议问题