StuFF mc
StuFF mc

Reputation: 4169

HearthRateMonitor/BT101 Sample in Swift: discoverServices's delegate methods not called

over here (GitHub link) I'm trying to "follow/reproduce" the HearthRateMonitor sample in Swift. All is fine until "discoverServices(nil)" which isn't calling any of my delegate methods.

Specifically, where

[aPeripheral discoverServices:nil];

in ObjC (See TimBurk's iOS Mirror of HRM @ GitHub), this Code in Swift

peripheral.discoverServices(nil)

(Mine), isn't calling any of the delegate methods

Any Idea? FYI I've also posted this in the Core Bluetooth and Swift DevForums.

Upvotes: 0

Views: 335

Answers (1)

McZonk
McZonk

Reputation: 1390

Your behavior is different from the original code. You need to retain the peripheral. See: https://github.com/timburks/iOSHeartRateMonitor/blob/dc8c186d7838aaad47345baf89a4f2c2b29ff5c7/HRM/HeartRateViewController.m#L127

Upvotes: 1

Related Questions