OS 10.9.1 didReceiveReadRequest未被调用

时间:2014-01-30 14:31:53

标签: objective-c macos core-bluetooth

在我继续努力使MacBook看起来像我的真实外围设备之一,出于测试目的,我发现didReceiveReadRequest没有被调用。

如何配置CBMutableCharacteristic,以便在阅读时调用didReceiveReadRequest结果?

1 个答案:

答案 0 :(得分:2)

您必须在特征初始化时将nil设置为value。这样它就变成了动态特征。详细描述了in the documentation

[[CBMutableCharacteristic alloc] initWithType:[CBUUID UUIDWithString:MY_UUID]
                                   properties: CBCharacteristicPropertyRead|CBCharacteristicPropertyIndicate
                                        value:nil  // this is the critical part
                                  permissions:CBAttributePermissionsReadable];

您可以在此项目中找到其他示例:AttackPattern/BlueSim