苹果手机蓝色搜素返回res设备内容里name和localname未空怎么办?
发布于 6 年前 作者 olu 923 次浏览 来自 官方Issues

江湖救急啊,我的蓝牙设备出厂前就已经有蓝牙名称,是按照BLE打头的,小程序里去搜素蓝牙设备,安卓下是可以发现包含BLE打头的设备,但苹果手机缺无法搜到BLE打头的设备。但是在苹果手机里下个蓝牙助手,搜一下,在连接一下,发现以后就可以搜到BLE打头的设备了。这个问题怎么解决啊

wx.onBluetoothDeviceFound(searchBluecallbackF);

function searchBluecallbackF(res) {

  for (var x in res.devices) {

    if (res.devices[x].name.indexOf(“BL”) != -1 ) console.log(“蓝牙信息:” + res.devices[x].deviceId + " name:" + res.devices[x].name+"  deviceinfo:"+res.devices[x]);

    if (res.devices[x].name==null)continue;

    if ((res.devices[x].name.indexOf(“BLELOCK”) != -1) || (res.devices[x].name.indexOf(“BLDLOCK”) != -1)){

      console.log(res);

    }

  }

1 回复

在原生app是正常使用的么?

回到顶部