CoreBluetooth上的通知返回CBErrorDomain代码= 0

问题描述 投票:8回答:3

我正在尝试编写一个使用CoreBluetooth框架的应用程序。我能够搜索设备并连接/断开连接,然后将值写入设备中的特征。当我尝试启用通知时:

[peripheral setNotifyValue:flag forCharacteristic:characteristic];

…这将触发:

- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error

但是总是返回错误

Error Domain=CBErrorDomain Code=0 "The operation couldn’t be completed. (CBErrorDomain error 0.)"

我已经上网查看了这可能意味着什么。我已经清理,重新构建,重新启动了iPhone,重新启动了Xcode,但是我一直遇到此错误。这是什么意思,我该如何解决?

ios notifications core-bluetooth
3个回答
0
投票

我也收到这些错误。我认为当您尝试读取一个标记为只能通过通知使用而不是直接读取的值时,会发生其中一些错误。我不知道其他值是什么。


0
投票

这是iOS6上的问题,而不是iOS5上的问题吗?可能是GATT配置文件,请检查权限(如果设置正确)。 iOS5 CoreBluetooth会忽略一些错误。


0
投票
  1. 检查UUID。
  2. 检查特征的许可。应该设置为通知。
© www.soinside.com 2019 - 2024. All rights reserved.