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:

  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.
Volodymyr Klymenko / Володимир Клименко

Written by

Software developer 👨‍💻Open Source contributor 🌎 Seneca ‘19 👨‍🎓🇨🇦 🇺🇦

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade