core-bluetooth

Scan, connect, and exchange data with Bluetooth Low Energy peripherals on iOS.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill core-bluetooth-dfly7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core-bluetooth
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/core-bluetooth
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill core-bluetooth-dfly7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides actionable guidance and ready-to-adopt patterns for scanning, connecting to, and exchanging data with Bluetooth Low Energy peripherals on iOS, removing uncertainty around Core Bluetooth lifecycle, background behavior, and state restoration.

Core Features & Use Cases

  • Central role: Scan for peripherals with service filtering, connect, discover services and characteristics, and manage notifications and read/write operations.
  • Peripheral role: Advertise services, publish characteristics, respond to read/write requests, and manage subscriptions and L2CAP channels.
  • Reliability & background: Covers background central/peripheral modes, state restoration identifiers, reconnection strategies, characteristic property checks, and common pitfalls to avoid.
  • Use Case: Implement a heart-rate monitor app that discovers nearby monitors, connects, reads battery and heart-rate characteristics, subscribes to live updates, and restores connections after app relaunch.

Quick Start

Use the core-bluetooth skill to scan for nearby heart rate monitors, connect to a device, discover its services and characteristics, and subscribe to heart rate notifications.

Frequently Asked Questions about core-bluetooth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan and connect to BLE peripherals in an iOS app?

To scan and connect to BLE peripherals, initialize CBCentralManager, filter discovered devices by service UUIDs, and invoke connect. You then discover services and characteristics to read, write, or subscribe to notifications.

How does Core Bluetooth state restoration work after an app relaunch?

Core Bluetooth state restoration preserves central and peripheral connections across app relaunches by assigning restoration identifiers to managers. The system reinitializes managers and replays pending events, allowing seamless recovery of BLE sessions.

Can I use Core Bluetooth for background BLE scanning and advertising?

Yes, Core Bluetooth supports background BLE scanning and advertising when you add the Bluetooth and central/peripheral background modes keys to Info.plist. Background operations are limited to service-filtered scanning and persistent connections.

How do I implement a peripheral role to advertise BLE services?

To implement a peripheral role, configure CBPeripheralManager with your custom service and characteristic UUIDs. You can then advertise these services, publish characteristics, and respond to incoming read, write, and subscription requests.

Why does my Core Bluetooth characteristic read or write operation fail?

Characteristic read or write operations fail when properties are mismatched. You must check characteristic properties to verify if they support read, write, notify, or indicate actions before attempting data exchange.

What is the best way to manage BLE peripheral reconnection strategies?

The best way to manage BLE reconnection is to utilize state restoration identifiers alongside central manager state monitoring. This handles disconnected peripherals and automatically triggers reconnection when target devices become available.