title: CoreBluetooth peripheral.name is always nil
body: <p>I just want to have the list of nearby Bluetooth devices' names. However, peripheral.name is always nil. The name in Advertising package is also always nil. I have 7 devices nearby. I can see them but not their names. </p>
  
  <p>I am using Swift2.0 and XCode7.</p>
  
  <p>My code is as  follows (I added CoreBluetooth.framework as well):</p>
  
  <pre><code>import UIKit
  import CoreBluetooth
  
  class ViewController: UIViewController, CBCentralManagerDelegate {
  
      var centralManager: CBCentralManager!
      var blueToothReady = false
  
      override func viewDidLoad() {
          super.viewDidLoad()
          startUpCentralManager()
      }
  
      func startUpCentralManager() {
          print("Initializing central manager")
          centralManager = CBCentralManager(delegate: self, queue: nil)
      }
  
      func discoverDevices() {
          print("discovering devices")
          centralManager.scanForPeripheralsWithServices(nil, options: nil)
          // centralManager.scanForPeripheralsWithServices(nil, options: [CBCentralManagerScanOptionAllowDuplicatesKey : NSNumber(bool: true)])
  
      }
  
      func centralManager(central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData: [String : AnyObject], RSSI: NSNumber) {
          let nameOfDeviceFound = (advertisementData as NSDictionary).objectForKey(CBAdvertisementDataLocalNameKey) as? NSString
          print("\(nameOfDeviceFound)")
          print("Discovered \(peripheral.name)")
      }
  
  
      func centralManager(central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral) {
          print("Connected to a peripheral")
      }
  
  
      func centralManager(central: CBCentralManager, didFailToConnectPeripheral peripheral: CBPeripheral, error: NSError?) {
          print("Failed to connect to peripheral")
      }
  
      func centralManager(central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: NSError?) {
          print("Disconnected from Peripheral")
      }
  
      func centralManager(central: CBCentralManager, willRestoreState dict: [String : AnyObject]) {
          print("Will restore state")
      }
  
      func centralManagerDidUpdateState(central: CBCentralManager) {
          print("checking state")
          switch (central.state) {
          case .PoweredOff:
              print("CoreBluetooth BLE hardware is powered off")
  
          case .PoweredOn:
              print("CoreBluetooth BLE hardware is powered on and ready")
              blueToothReady = true;
  
          case .Resetting:
              print("CoreBluetooth BLE hardware is resetting")
  
          case .Unauthorized:
              print("CoreBluetooth BLE state is unauthorized")
  
          case .Unknown:
              print("CoreBluetooth BLE state is unknown");
  
          case .Unsupported:
              print("CoreBluetooth BLE hardware is unsupported on this platform");
  
          }
          if blueToothReady {
              discoverDevices()
          }
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  }
  </code></pre>
  
  <p>Thanks in advance. </p>