title: IOBluetooth or CoreBluetooth | How to connect iOS with a non MFi medical bluetooth device
body: <p>I'd like to setup a connection between a iPhone and a medical device which provides information about the heart. I will get information about the bluetooth protocol soon. At the moment I have trouble using apple's bluetooth library. Is CoreBluetooth or IOBluetooth better for connecting to non MFI devices?</p>
  
  <p>Here is some code I found (<a href="https://stackoverflow.com/questions/24321126/get-bluetooth-devices-in-range-with-swift">link</a>) it should find all devices around but it didn't work. I tried different ways to set things up.</p>
  
  <pre><code>import IOBluetooth
  import XCPlayground
  
  class BlueDelegate : IOBluetoothDeviceInquiryDelegate{
      func deviceInquiryComplete(sender: IOBluetoothDeviceInquiry, error: IOReturn, aborted: Bool) {
          aborted
          println("called")
          var devices = sender.foundDevices()
          for device : AnyObject in devices {
              if let thingy = device as? IOBluetoothDevice {
                  thingy.getAddress()
              }
          }
      }
  }
  
  var delegate = BlueDelegate()
  var inquiry = IOBluetoothDeviceInquiry(delegate: delegate)
  inquiry.start()
  XCPSetExecutionShouldContinueIndefinitely()
  </code></pre>
  
  <p>I tried to use CoreBluetooth too but it didn't call the delegates methods either.</p>