收藏
回答

IOS下蓝牙不正常 setNotifyOnCharacteristics error 10007?

蓝牙监听不一致,几天了都没解决,求助!!

同样的代码,同一个设备,安卓没有问题,但IOS就会报:

notifyBLECharacteristicValueChange:fail setNotifyOnCharacteristics error 10007

var that = this;
    wx.notifyBLECharacteristicValueChange({
      statetrue// 启用 notify 功能
      deviceId: that.data.deviceId,
      serviceId: that.data.serviceId,
      characteristicId: that.data.notifyCharacteristicId,
      successfunction (res{
        console.log('[ok]8.2 notify启动成功', res.errMsg);
        console.log('[监听]' + that.data.deviceId + '--' + that.data.serviceId + '--' + that.data.notifyCharacteristicId);
        that.onBLECharacteristicValueChange(); //监听特征值变化
      },
      failfunction (res{
        console.log('[ok]8.2 notify启动失败', res.errMsg);
        console.log('[监听]' + that.data.deviceId + '--' + that.data.serviceId + '--' + that.data.notifyCharacteristicId);
        wx.showToast({
          title'notify启动失败',
          masktrue
        });
        setTimeout(function () {
          wx.hideToast();
        }, 2000)
      }


回答关注问题邀请回答
收藏

1 个回答

  • 社区技术运营专员--许涛
    社区技术运营专员--许涛
    2021-05-07

    你好,麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

    2021-05-07
    有用
    回复 11
    • ajiu
      ajiu
      2021-05-07
      https://developers.weixin.qq.com/s/BbFvU7mH7Oq0 要有硬件设备才能看效果吧,只发代码不知道有没有用
      2021-05-07
      回复
    • 社区技术运营专员--许涛
      社区技术运营专员--许涛
      2021-05-08回复ajiu
      公众号蓝牙吗?还是小程序蓝牙
      2021-05-08
      回复
    • ajiu
      ajiu
      2021-05-08回复社区技术运营专员--许涛
      小程序啊
      2021-05-08
      回复
    • 社区技术运营专员--许涛
      社区技术运营专员--许涛
      2021-05-08回复ajiu
      你在同一个服务下有两个相同uuid的特征值,由于目前小程序是按照uuid来索引特征值,这个情况下会索引到后面那一个特征值进行notify,因此失败,未来会对同uuid的情况进行支持,目前需要先规避一下问题
      2021-05-08
      回复
    • ajiu
      ajiu
      2021-05-08回复社区技术运营专员--许涛
      安卓是正常的哦,“这个情况下会索引到后面那一个特征值进行notify”   这个bug仅是IOS吗?
      2021-05-08
      回复
    查看更多(6)
登录 后发表内容