真机开发中小程序蓝牙连接正常,发布到体验版本却无法扫描到蓝牙?
发布于 6 年前 作者 gsun 13160 次浏览 来自 官方Issues

如题,请问有了解的朋友吗?麻烦指点一二,谢谢谢谢~~~

2 回复

openBluetooth: function () {

const that = this;

wx.openBluetoothAdapter({

success(res) {

console.log("打开蓝牙成功", res);

},

fail(res) {

console.log("打开蓝牙失败", res)

if (res.errCode = "10001") {

wx.showModal({

title: '提示',

content: '检查蓝牙是否开启',

})

}

}

})

wx.getBluetoothAdapterState({

success: function (res) {

console.log("获取蓝牙初始化状态", res)

that.searchNearBluetooth();

},

fail: function (res) {

console.log("获取蓝牙初始化状态失败", res)

}

})

},

searchNearBluetooth: function () {

const that = this;

// 搜索附近蓝牙设备

wx.startBluetoothDevicesDiscovery({

success: function (res) {

console.log("搜索蓝牙设备", res)

wx.showToast({

title: '',

icon: 'loading',

duration: 3000

})

that.foundBluetooth();

},

fail: function (res) {

console.log("搜索失败时", res)

}

})

},

小米9,MIUI11.05,微信版本7.0.10

你好,上传至体验版无法扫描蓝牙,那接口是否有返回详细的错误信息呢

回到顶部