收藏
回答

(已解决)iPhoneXR低功耗蓝牙startBeaconDiscovery 报错11000?

手机: iPhoneXR

微信版本号:7.0.10

问题:wx.startBeaconDiscovery 调用时报错 11000。其他测试机暂时没问题(iPhoneXS、iPhoneX、Android..)

代码:

index.js

let timer = ''
Page({
  data: {
    getStatus: false,
    time: 0,
    beacons: []
  },
  startBeaconDiscovery() {
    clearInterval(timer)
    this.setData({
      time: 0,
      beacons: []
    })


    timer = setInterval(() => {
      this.setData({
        time: this.data.time + 10
      })
    }, 10)


    wx.startBeaconDiscovery({
      uuids: ['FDA50693-A4E2-4FB1-AFCF-C6EB07647826', 'FDA50693-A4E2-4FB1-AFCF-C6EB07647825'],
      success: (res) => {
        console.log('startBeaconDiscovery_success', res)
        wx.onBeaconUpdate(res2 => {
          console.log('onBeaconUpdate_res: ', res2)
          if (res2.beacons && res2.beacons.length) {
            this.setData({
              beacons: res2.beacons,
              getStatus: true
            })


            wx.offBeaconUpdate()
            wx.stopBeaconDiscovery()
            clearInterval(timer)
          }
        })
      },
      fail: res => {
        console.log('startBeaconDiscovery_fail: ', res)
      }
    })
  },
  stopBeaconDiscovery() {
    wx.offBeaconUpdate()
    wx.stopBeaconDiscovery()
    clearInterval(timer)
    this.setData({
      time: 0,
      beacons: []
    })
  },
})



index.wxml

开始扫描结束流程

耗时:{{ time / 1000 }}s

uuid:{{ item.uuid }}major:{{ item.major }}minor:{{ item.minor }}
最后一次编辑于  01-20
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签