微信小程序调用wx.getBLEDeviceServices返回10004

wx.getBLEDeviceServices华为手机使用返回错误码10004,但是在ios上可以调用成功,请问各位知道这是为什么吗或者我该怎么样修改

wx.getBLEDeviceServices({
                        deviceId: deviceId,
                        success(res) {
                            console.log(res.services);
                            that.services = res.services;
                            let uuid = res.services;
                            let len = uuid.length;
                            if (characteristicid !== 'B3A36DF3-B464-F5FC-4334-FB87794E69CE') {
                                console.log('获取蓝牙设备service111');
                                // for (let i = 0; i < len; i++) {
                                    that.getCharacteristics(deviceId, res.services[3].uuid, text,
                                        characteristicid,
                                        readUUID);
                                // }
                            } else {
                                console.log('我写入用户ID,我走这儿~~');
                                // for (let i = 0; i < len; i++) {
                                    that.getCharacteristics(deviceId, res.services[2].uuid, text,
                                        characteristicid,
                                        readUUID);
                                // }
                            }

                        },
                        fail(res) {
                            console.log('获取蓝牙设备service失败', res);
                        }
                    });

引用 皆我百晓生 小程序回复内容作答:

错误码10004表示获取服务失败。可能的原因是蓝牙设备没有正确开启或者与设备之间的连接已经断开。对于华为手机,有些型号可能存在兼容性问题。你可以尝试以下解决方法:

  1. 确保蓝牙设备已正确开启,且与手机的距离在有效范围内。
  2. 重新打开微信小程序,尝试重新连接蓝牙设备。
  3. 确保手机系统和微信小程序均为最新版本,有时候更新可以修复兼容性问题。
  4. 在代码中添加错误处理,当获取服务失败时进行重试或者给出提示。
  5. 如果以上方法仍然无法解决问题,可能是部分华为手机型号对于wx.getBLEDeviceServices方法存在兼容性问题,你可以尝试使用其他方法或者联系华为客服寻求帮助。

另外,你可以将console.log的输出结果提供出来,以便更好地帮助你解决问题。