How to start a bluetooth connection?

To start a bluetooth peripheral searh on the Mac OS I did what exemplified below, but the switch falls into unsupported case.

What have I to do to turn on bluetooth?

class BTSearch: NSObject, CBCentralManagerDelegate
{
     override init()
     {
          super.init()
          centralManager = CBCentralManager(delegate: self, queue: nil)
     }
     func centralManagerDidUpdateState(_ central: CBCentralManager)
     {
          switch (central.state)
          {
          case .unsupported:
          case ...

          }
     }
}

Replies

Not sure if you figured this out or if anyone else comes across this thread, the underlying issue might be that the default macOS app is sandboxed with Bluetooth capabilties turned off. Either the Sandbox option has to be turned off or the Bluetooth capability turned on under Sandbox mode.

Without response for a long time I was not more checking this tread.

Now I'm busy on another app. When I came back on bluetooth I'll use your suggestion.

Thanks.