peripheral:didUpdateValueForCharacteristic无法访问

时间:2013-05-04 14:06:39

标签: ios core-bluetooth

我的代码基于Apple的名为“ TemperatureSenor ”的CoreBluetooth示例代码。 我发现一种现象,如果我设置外围设备重复发送消息,则调用peripheral:setNotifyValue:YES forCharacteristic:,最后调用peripheral:didUpdateValueForCharacteristic:
如果我呼叫peripheral:setNotifyValue:YES forCharacteristic:来收听来自外围设备的消息,然后将外围设备设置为向中心发送消息,则中心将不会呼叫peripheral:didUpdateValueForCharacteristic:。 是什么原因?

1 个答案:

答案 0 :(得分:0)

也许您应该确定您用于发送消息的特性是否具有由外围设备决定的通知属性。如果您的特性没有通知属性但仍然称为“peripheral:setNotifyValue:YES forCharacteristic:” ,你会收到未知错误2。 如果您的特征具有通知属性并且您调用“peripheral:setNotifyValue:YES forCracterracter:”,则中心将调用“peripheral:didUpdateValueForCharacteristic:”