How to set up Core Bluetooth for a macOS app
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:
- Go to Project Settings -> Capabilities -> App Sandbox
- Check in Bluetooth option under “Hardware” heading
- Then, go to Info.plist
- Add “Privacy — Bluetooth Peripheral Usage Description” property, and add a description of how your app is going to use Bluetooth.