搜索附近蓝牙设备设置了不允许重复上报,wx.onBluetoothDeviceFound在苹果14依然上报了重复的设备,华为上正常
wx.startBluetoothDevicesDiscovery({
allowDuplicatesKey: false, //不允许重复上报
// services: [''],//指定services搜索 0000ffe0-0000-1000-8000-00805f9b34fb
success: function (res) {
console.log("开始搜索附近蓝牙设备")
that.setData({
searchingstatus: true,
disabled: true,
})
that.onBluetoothDeviceFound()
onBluetoothDeviceFound() {
wx.onBluetoothDeviceFound((res) => {
res.devices.forEach(device => {
this.data.devices.push(device)
this.setData({ devices: this.data.devices })
})
})
},
解决了不????
这好正常哦。ios有自己的算法