(已解决)iPhoneXR低功耗蓝牙startBeaconDiscovery 报错11000?
发布于 7 年前 作者 pgong 9401 次浏览 来自 官方Issues

手机: 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 }}
1 回复

测试了下xr,没复现报错的问题

回到顶部