- iOS设备BLEPeripheralServer.addService一直返回1509000错误
小程序 iOS系统 BLEPeripheralServer.addService 返回 {errno: 1509000, errMsg: "addBLEPeripheralService:ok"}; 安卓系统返回 {errno: 0,errCode: 0, errMsg: "addBLEPeripheralService:ok"} 导致无法连接BLE蓝牙设备 iOS版本:15.4.1 型号:iPhone 6s Plus 示例代码: const baseServiceId = '07CEDB7C-0A62-A8D6-57E2-C9BB0E4EB60B' const baseCharacteristicId = '07CEDB7C-0A62-A8D6-57E2-C9BB0E4EB60C' openBluetoothAdapter() { wx.openBluetoothAdapter({ mode: 'peripheral', success: (res) => { console.log("openBluetoothAdapter(peripheral for iOS):", res); this.createBLEPeripheralServer(); }, fail: (res) => { console.error("openBluetoothAdapter (peripheral for iOS) error:", res) } }) }, createBLEPeripheralServer() { wx.createBLEPeripheralServer({ success: (result) => { console.log('外围Server创建成功', result); if (result.server) { this.addBLEPeripheralServices(result.server) } }, fail: (err) => { console.log('外围Server创建失败', err); } }) }, addBLEPeripheralServices(server) { server.addService({ service: { uuid: baseServiceId, characteristics: [{ uuid: baseCharacteristicId, properties: { writeNoResponse: true, read: true }, permission: { writeable: true, readable: true } }] }, success: (res) => { console.log('添加Service结果', res); if (res.errno == 0) { console.log('添加Service成功'); } else if (res.errno == 1509000) { wx.showToast({ title: "蓝牙设备未知错误", icon: "error" }) } }, fail: (err) => { console.log('添加Service失败', err); } }) }, iOS端创建Service时报1509000错误 [图片]
2023-11-30 - Switch组件设置自定义color后JS动态设置checked后颜色变成了默认的绿色
Switch按钮设置了一个自定义颜色,"#0372e2", 当滑动Slider时,JS设置Switch为checked状态,然后Switch按钮变成了默认的绿色 [图片] 手动点击Switch按钮时显示设置的颜色: [图片] 但是一旦与slider联动,JS端设置Switch的checked状态,又无法显示关闭的灰色了 [图片]
2023-09-22