m***@qq.com
m***@qq.com
  • 发布:2019-01-17 18:06
  • 更新:2019-01-22 15:58
  • 阅读:1853

【报Bug】Uniapp蓝牙发现报错

分类:uni-app

详细问题描述(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
[内容]:
启用蓝牙发现后,开启低功耗蓝牙设备,onBluetoothDeviceFound报错,编译成小程序可以正常工作。
同时尝试了uni和plus.bluetooth都不行。

小程序返回正确的数据,编译成APP会报错(TypeError: Cannot read property 'map' of null)
分析:应该是发现了这个设备,在回调onBluetoothDeviceFound时报错
{
"deviceId": "00:60:19:61:1D:45",
"name": "Accu-Chek",
"RSSI": -56,
"advertisData": {},
"advertisServiceUUIDs": ["00001808-0000-1000-8000-00805F9B34FB"],
"localName": "Accu-Chek",
"serviceData": {
"00001808-0000-1000-8000-00805F9B34FB": ""
}
}

重现步骤
[步骤]
启用蓝牙发现,开启onBluetoothDeviceFound
[结果]
TypeError: Cannot read property 'map' of null
[期望]
返回正确的蓝牙设备信息
[如果语言难以表述清晰,可以拍一个视频或截图,有图有真相]

IDE运行环境说明
[HBuilderX]
[IDE版本号] 1.4.1.20181228
[windows版本号] WIN10

App运行环境说明
[Android版本号] 5.1.1
[iOS版本号]
[手机型号] OPPO R9 Plusm A
[模拟器型号]

联系方式
[QQ]95122137

2019-01-17 18:06 负责人:无 分享
已邀请:
DCloud_Android_zl

DCloud_Android_zl

麻烦提供一下当前webview的版本号
查看方法:

  1. 点击设置中开发者选项,找到webview实现(或类似按钮),点击查看当前webview的版本号
  2. 运行当前基座,在chrome中输入chrome://inspect/#devices,然后在当前设备名称下会显示webview的版本号,类似如下格式,后面的数字即为当前webview版本号
  3. > MI NOTE LTE

    56D2261C

    WebView in io.dcloud.HBuilder (57.0.2987.132)

m***@qq.com

m***@qq.com (作者) - 80后iT老玩童

OPPO R9 Plusm A

19B2AF6F

WebView in io.dcloud.HBuilder (70.0.3538.64)
⚠ Remote browser is newer than client browser. Try inspect fallback if inspection fails.

Hello H5+
file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/www/index.html
inspectinspect fallback

m***@qq.com

m***@qq.com (作者) - 80后iT老玩童

我更换了另外一个手机,也是同样的问题
Remote Target

LOCALHOST

Coolpad Y82-820

DB1AD139

WebView in io.dcloud.HBuilder (33.0.0.0)

Hello H5+
file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/www/index.html
inspect

操作步骤

  1. 打开蓝牙模块
  2. 开始扫描蓝牙设备
    这时是可以扫描到一些设备的 (例如:可以正确识别出小米手环等)
  3. 我打开低功耗设备(连接功能,默认这个设备是不能被扫描出来的)
    这时就会报(TypeError: Cannot read property 'map' of null)
  4. 其它设备的还是可以正常输出
    在小程序中是正常的
  • DCloud_Android_zl

    当前出问题的只有酷派这款手机和OPPO的吗?麻烦提供一下酷派和OPPO手机的安卓版本号吧。

    2019-01-21 18:06

  • m***@qq.com (作者)

    其它手机还没有试,OPPO的版本号是5.1.1, 酷派是4.4.4

    2019-01-21 18:46

m***@qq.com

m***@qq.com (作者) - 80后iT老玩童

补充下错误日志, 这个错误是在我启用 低功耗设备的连接功能时出现的;
启动连接功能,这个设备才能被描扫到。通过LightBlue和小程序,都是可以正常工作识别这个设备。

[{"deviceId":"49:C2:73:D7:7C:B1","name":"","RSSI":-82,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:51.035 TypeError: Cannot read property 'map' of null
15:40:51.157 发现的蓝牙设备:{"devices":[{"deviceId":"52:23:AD:67:E9:26","name":"","RSSI":-78,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:51.734 发现的蓝牙设备:{"devices":[{"deviceId":"62:1D:2B:2D:5E:A6","name":"","RSSI":-88,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:51.755 TypeError: Cannot read property 'map' of null
15:40:51.878 发现的蓝牙设备:{"devices":[{"deviceId":"03:90:74:27:4C:25","name":"","RSSI":-80,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:51.899 发现的蓝牙设备:{"devices":[{"deviceId":"45:63:A7:DC:EE:9C","name":"","RSSI":-81,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:51.919 TypeError: Cannot read property 'map' of null
15:40:52.043 TypeError: Cannot read property 'map' of null

15:40:52.166 发现的蓝牙设备:{"devices":[{"deviceId":"FE:70:D1:C5:49:32","name":"Mi Band 3","RSSI":-94,"localName":"Mi Band 3","advertisServiceUUIDs":["0000fee0-0000-1000-8000-00805f9b34fb"],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:52.194 deviceId:FE:70:D1:C5:49:32, name:Mi Band 3 at pages/center/equipments/bluetooth/add.vue:73
15:40:52.207 发现的蓝牙设备:{"devices":[{"deviceId":"59:C5:E4:7D:CA:41","name":"","RSSI":-93,"localName":"","advertisServiceUUIDs":[],"advertisData":{}}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:52.740 TypeError: Cannot read property 'map' of null
15:40:52.863 发现的蓝牙设备:{"devices":[{"deviceId":"80:7A:BF:17:F5:C3","name":"HTC BS C3D5B4","RSSI":-100,"localName":"HTC BS C3D5B4","advertisServiceUUIDs":["0000cb00-0000-1000-8000-00805f9b34fb"]}]} at pages/center/equipments/bluetooth/add.vue:63
15:40:52.883 deviceId:80:7A:BF:17:F5:C3, name:HTC BS C3D5B4 at pages/center/equipments/bluetooth/add.vue:73
15:40:52.904 TypeError: Cannot read property 'map' of null

m***@qq.com

m***@qq.com (作者) - 80后iT老玩童

试了下Redmi 6, 问题仍然存在

2A22965E7D28

WebView in io.dcloud.HBuilder (68.0.3440.91)
Android版本 8.1.0

  • DCloud_Android_zl

    麻烦在HBuilderX中创建一个5+APP项目,用5+项目中的蓝牙示例尝试连接一下

    2019-01-22 16:31

  • m***@qq.com (作者)

    我尝试了下,还是同样的问题和错误

    2019-01-23 09:11

该问题目前已经被锁定, 无法添加新回复