title: How would i scan for other iphone devices
body: <p>Hi I want to create a simple app when the app opens for the first time it will show other apple devices in my house that uses Bluetooth and it prints the device name. I am unsure how I can go about this using CoreBluetooth. I have tried a tutorial which i have put down below but it does not show the devices in my house and i have turned on bluetooth. It only shows my neighbour samsung tv. I was also wondering how i would a UUID so that i don't have repeated values in the console. I have even tried lightBlue app and it only show this samsung tv.</p>
  <p><a href="https://i.stack.imgur.com/xA5HT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xA5HT.png" alt="Console" /></a></p>
  <p>Code</p>
  <pre><code>import UIKit
  import CoreBluetooth
  
  
  class ViewController: UIViewController,CBCentralManagerDelegate {
      private var centralManager : CBCentralManager!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
          centralManager = CBCentralManager(delegate: self, queue: nil, options: nil)
  
          view.backgroundColor = .white
      }
      
      func centralManagerDidUpdateState(_ central: CBCentralManager) {
          if central.state == .poweredOn {
              print(&quot;Bluetooth is On&quot;)
              centralManager.scanForPeripherals(withServices: nil, options: nil)
          } else {
              print(&quot;Bluetooth is not active&quot;)
          }
      }
      
   
      public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
          print(&quot;\nName   : \(peripheral.name ?? &quot;(No name)&quot;)&quot;)
          print(&quot;RSSI   : \(RSSI)&quot;)
          for ad in advertisementData {
              print(&quot;AD Data: \(ad)&quot;)
          }
      }
      
  
  
  
  }
  </code></pre>