how to connect with bluetooth low energy in ios swift?

我与影子孤独终老i 提交于 2019-12-01 06:36:48

I created a demo project, which scans for Bluetooth LE devices and displays them in a list:

Check it out on github: quickies/BluetoothScanner.ios

Screenshot

I've solved this.
just need to change :

func centralManager(central: CBCentralManager, didConnect peripheral: CBPeripheral)

into this :

func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral)

reference : Swift 3: Can't connect to peripheral via BLE

      @IBAction func btnConnect(_ sender: UIButton){

        self.appDelegate.bleManager.stopScan()

        self.appDelegate.selectPeripheral = self.arrayPeripheral[sender.tag]

        self.appDelegate.bleManager.connect(self.selectPeripheral, options: nil)

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