If you create a Cocoa macOS app in Xcode, import Core Bluetooth and try to use this framework, you’ll run into an error:
[CoreBluetooth] XPC connection invalid
Here is a quick guide on how to set up your macOS project to work with Core Bluetooth:
1. Go to Project Settings -> Capabilities -> App Sandbox
2. Check in Bluetooth option under “Hardware” heading
3. Then, go to Info.plist
4. Add “Privacy — Bluetooth Peripheral Usage Description” property, and add a description of how your app is going to use Bluetooth.