i hope you're doing great, I'm having an issue that when i search for bluetooth devices, i get some of devices with name, most of the devices does not show up with their name even at the same time those devices which names are not shwoing up ,shows up with their name in Iphone's bluetooth. So, I tried some solutions
1- first connect to device then get the name in delegate (peripheralDidUpdateName) , in this i get response from few devices while other devices stuck in connecting state
2- i tried to search for devices with some delays so i could find the name but still stuck in same issue
CBCentralManagerDelegate , CBPeripheralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch (central.state) {
case .poweredOff :
print("bluetooth is off ")
self.mainPeripheral.removeAll()
case .poweredOn :
print("bluetooth is on ")
manager?.scanForPeripherals(withServices: nil, options: nil)
}
}
actual output :
CBPeripheral: 0x282d090e0, identifier = D94CC0E6-0340-8406-4688-C38D593F3201, name = (null), state = disconnected>
<CBPeripheral: 0x282d0d040, identifier = 04F5A632-3FBE-47A6-C6A6-2DDF9975184C, name = (null), state = disconnected>
<CBPeripheral: 0x282d0d040, identifier = CE0FD194-7E7D-4004-C50B-049C2958F495, name = (null), state = disconnected>
<CBPeripheral: 0x282d0d040, identifier = 0A2A2B66-41A8-1508-5B86-42791D680C63, name = (null), state = disconnected>
<CBPeripheral: 0x282d08960, identifier = C27643E9-C83A-01B3-0A11-92A347028199, name = (null), state = disconnected>
<CBPeripheral: 0x282d0d040, identifier = E780781F-7D6B-8052-9743-ECFEB5C534C8, name = (null), state = disconnected>
expected :
<CBPeripheral: 0x282d0c0a0, identifier = 803732A6-31F9-A740-EC6A-8C9E3CDE8F71, name = Lefun, state = disconnected>
<CBPeripheral: 0x282d0d040, identifier = 6C19BC9F-1891-82DE-51D6-0C0E371F2E03, name = LH719, state = disconnected>