求官方回答,是手机问题还是基础库问题
发布于 5 年前 作者 chao53 11904 次浏览 来自 问答

下面的代码走到第一步,ios6.5.9蓝牙突然断开连接后 wx.getBLEDeviceCharacteristics不会触发fail方法,实际基础库的问题还是手机问题,求一个回答。手机调试的时候只打印了第一次成功,然后发现蓝牙上面的小标变暗了,然后就什么都没有打印。并没有触发fail函数。

wx.getBLEDeviceServices({

          deviceId: deviceId,

          success: function (res1) {

            console.log(‘这是第一次成功’, res1)

            if (that.data.platform === ‘ios’) {

              var serviceId = res1.services[1].uuid

            } else {

              var serviceId = res1.services[0].uuid

            }

            wx.getBLEDeviceCharacteristics({

              deviceId: deviceId,

              serviceId: serviceId,

              success: function (res2){

                  console.log(‘这是第二次成功’, res2)

 

},

              fail: function (res2) {

                console.log(‘这里是第二次失败’, res2)

                that.eCommand();

              }

            })

            },

          fail: function (res1) {

            console.log(‘这里是第一次失败’, res1)

            that.eCommand();

          }

        })

1 回复

这个情况是偶发性的,

回到顶部