How to get list of names of available bluetooth devices in ios swift?

Viewed 3511

this question is a replica of this qustion

I have declared CBCentralManagerDelegate in my class and var cb = CBCentralManager()

I set the delegate as cb.delegate = self

I search the devices as cb.scanForPeripheralsWithServices(nil, options: nil)

func centralManager(central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData: [String : AnyObject], RSSI: NSNumber) {
    print("\(advertisementData.description)")
}

I am able to print the details. But in the log I get data like this:

["kCBAdvDataTxPowerLevel": 0, "kCBAdvDataLocalName": Smart Key, "kCBAdvDataManufacturerData": <bc00>, "kCBAdvDataServiceData": {
Battery = <64>;
}, "kCBAdvDataIsConnectable": 1]

All I want is the name of the device like: My2Device

2 Answers
Related