wx.connectWifi问题在https://developers.weixin.qq.com/community/develop/doc/0008c83a370010c54493273386b409?highLine=wx.connectWifi 这次更新解决了 可以看一下
微信官方真的按照约定修复了小程序wx.connectWifi的问题吗?使用wx.connectWifi连接的WiFi仅限小程序本身能用,在别的软件里面就没有网络,官方人员在相关问题下回复了会在微信8.0.60版本修复,我们这边更新了微信8.0.60并且在另一部设备上直接安装了8.0.60版本,测试结果依然无法使用,官方人员能不能出来回复一下到底修复了什么?附上相关问题的链接和官方人员在下面的回复,问题链接:https://developers.weixin.qq.com/community/develop/doc/0008a234a2cfd0637f43e3d7d66c00?highLine=wx.connectWifi官方人员回复的截图: [图片][图片]
09-17现在已解决 原来我是按顺序调用,但是不会触发。 // wx.startWifi({ // success (res) { // console.log(res.errMsg,"startWifi") // wx.getWifiList({ // success (res) { // console.log("获取WIFI列表---"); // wx.onGetWifiList((wifi)=>{ // console.log(wifi.wifiList,"wifi--------------"); // let data=wifi.wifiList||[]; // data.sort((a, b) => b.signalStrength - a.signalStrength) // console.log(data,"data___________________========++++"); // data=data.splice(0,10) // that.setData({ // wifiList:data, // }) // that.getAddress() // }) // }, // fail(err){ // console.log(err,"err=------"); // wx.hideLoading(); // that.setData({ // state:3 // }) // if(err.errCode==12001){ // wx.showToast({ // title: '当前系统不支持此功能', // icon: 'error', // duration: 2000 // }); // }else if(err.errCode==12005){ // wx.showToast({ // title: 'WI-FI开关未打开', // icon: 'error', // duration: 2000 // }); // }else if(err.errCode==12006){ // wx.showToast({ // title: '未打开 GPS 定位开关', // icon: 'error', // duration: 2000 // }); // }else{ // wx.showToast({ // title: '获取wifi失败', // icon: 'error', // duration: 2000 // }); // } // } // }) // }, // fail(res){ // console.log(res,"fail"); // wx.hideLoading(); // that.setData({ // state:3 // }) // wx.showToast({ // title: '获取wifi失败', // icon: 'error', // duration: 2000 // }); // }, // }) 要改成这样,换一下顺序就能触发了,是不是感觉很神奇。 const getWifiList=()=>{ wx.getWifiList({ success (res) { wx.onGetWifiList((wifi)=>{ let data=wifi.wifiList||[]; data.sort((a, b) => b.signalStrength - a.signalStrength) data=data.splice(0,10) that.setData({ wifiList:data, }) that.getAddress() }) }, fail(err){ wx.hideLoading(); that.setData({ state:3 }) if(err.errCode==12001){ wx.showToast({ title: '当前系统不支持此功能', icon: 'error', duration: 2000 }); }else if(err.errCode==12005){ wx.showToast({ title: 'WI-FI开关未打开', icon: 'error', duration: 2000 }); }else if(err.errCode==12006){ wx.showToast({ title: '未打开 GPS 定位开关', icon: 'error', duration: 2000 }); }else{ wx.showToast({ title: '获取wifi失败', icon: 'error', duration: 2000 }); } } }) } const startWifi = () => { wx.startWifi({ success: getWifiList, fail(res){ console.log(res,"fail"); wx.hideLoading(); that.setData({ state:3 }) wx.showToast({ title: '获取wifi失败', icon: 'error', duration: 2000 }); }, }) } wx.getSystemInfo({ success(res) { const isIOS = res.platform === 'ios' if (isIOS) { wx.showModal({ title: '提示', content: '由于系统限制,iOS用户请手动进入系统WiFi页面,然后返回小程序。', showCancel: false, success() { startWifi() } }) return } startWifi() } })
wx.onGetWifiList在ios中放在onShow内也不进入回调?[图片]
2024-06-21