【问题标题】:Crash in CBPeripheral writeValue: forDescriptor:CBPeripheral writeValue 中的崩溃:forDescriptor:
【发布时间】:2013-08-13 01:26:54
【问题描述】:

在与 TI BLE Keyfob 建立连接并检索特征描述符后,我尝试调用

   [peripheral writeValue: nsData forDescriptor: descriptor];

各种对象在调试器中看起来很合理。 nsData 有一个单字节 1,peripheral 是从 iOS 返回的看起来有效的 CBPeripheral 对象,descriptor 是从 iOS 返回的看起来有效的 CBDescriptor。

我的应用程序因错误而崩溃

* -[CBConcretePeripheral writeValue:forDescriptor:] 中的断言失败, /SourceCache/CoreBluetooth/CoreBluetooth-59.3/CBConcretePeripheral.m:358

关于为什么会发生这种情况或如何调试它的任何想法?

【问题讨论】:

    标签: ios core-bluetooth cbperipheral


    【解决方案1】:

    writeValue:forDescriptor文档中的注释

    客户端特征配置描述符不能写 使用这种方法,应该改用setNotifyValue:forCharacteristic:

    所以如果你试图写连接外设的描述符,那么它会失败。

    要编写特征,请使用- writeValue:forCharacteristic:type: 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-30
      • 2021-05-14
      • 2022-11-02
      • 1970-01-01
      • 2015-12-04
      • 2011-09-17
      • 1970-01-01
      • 2017-10-23
      相关资源
      最近更新 更多