Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

CoreBluetooth not discovering peripherals

rdar://23374935

Summary:

Bluetooth LE devices are never detected by a CBCentralManager when scanning for all devices.

Steps to Reproduce:

  1. Clone and run a Bluetooth LE peripheral, e.g. git clone git@github.com:sandeepmistry/osx-ble-peripheral.git
  2. Clone this example on an Apple TV: git clone git@github.com:bdotdub/CBExample.git
  3. Run the example on a tvOS device

Expected Results:

The CBCentralManagerDelegate discovery functions called with Bluetooth LE peripherals nearby

Actual Results:

None of the CBCentralManagerDelegate functions are called

Version:

tvOS 9.0

Notes:

Configuration:

Apple TV

Attachments:

@rcarlsen

This comment has been minimized.

Copy link

commented Nov 11, 2015

I believe that you are calling the centralManager too soon in the referenced example project. You must wait until the centralManager calls the delegate method centralManagerDidUpdateState() with a state parameter of .PoweredOn or higher before calling methods on the centralManager.

When I moved the call to scanForPerihperalsWithServices() into the .PoweredOn case in ..didUpdateState() then nearby peripherals were discovered as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.