小编use*_*170的帖子

didUpdateValueForCharacteristic(setNotifyValue:YES)不起作用

我希望在值发生变化时收到通知.我正在学习本教程 - > 核心蓝牙简介:构建心率监测器

我用这个蓝牙设备 - > IC卡读卡器(索尼产品)

- (void)viewDidLoad {
    [super viewDidLoad];
    _myCentralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
    [_myCentralManager scanForPeripheralsWithServices:nil options:nil];
    self.myCentralManager = _myCentralManager;
}

#pragma mark - CBCentralManagerDelegate

// method called whenever you have successfully connected to the BLE peripheral
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
{
    [peripheral setDelegate:self];
    [peripheral discoverServices:nil];
    NSString *connected = [NSString stringWithFormat:@"Connected: %@", peripheral.state == CBPeripheralStateConnected ? @"YES" : @"NO"];
    NSLog(@"%@", connected);
}

// CBCentralManagerDelegate - This is called with the CBPeripheral class as its …
Run Code Online (Sandbox Code Playgroud)

ios core-bluetooth bluetooth-lowenergy

1
推荐指数
1
解决办法
8625
查看次数

标签 统计

bluetooth-lowenergy ×1

core-bluetooth ×1

ios ×1