https://developers.weixin.qq.com/minigame/dev/api/network/tcp/wx.createTCPSocket.html
隐私授权已添加,无法成功调用chooseMedia接口?隐私授权功能已经添加了,今天突然chooseMedia接口无法使用,控制台也没报错就是调不起摄像头和文件
2023-10-19- 使用腾讯地图wx.chooseLocation接口选择地址,开发和体验版都正常,发布上线就报错?
[图片] 1、如上图所描述,在微信开发者工具和体验版本上,都可以正确获取到地址,唯独发布上线版本选择不了地址,报错信息如下: MiniProgramError result is not defined ReferenceError: result is not defined at e.fail (https://usr/app-service.js:11299:1870) at https://lib/WASubContext.js:2:101623 at https://lib/WASubContext.js:2:101776 2、贴出具体代码,有微信小程序的技术员能帮找一下具体原因吗,万分感谢! chose_location: function() { var that = this; wx.chooseLocation({ success: function(e) { console.log("选中的地址:"+e.address); var lon_lat = e.longitude + ',' + e.latitude; var path = e.address; var s_region = that.data.region; var dol_path = ''; var str = path; var patt = new RegExp("(.*?省)(.*?市)(.*?区)", "g"); var result = patt.exec(str); if (result == null) { patt = new RegExp("(.*?省)(.*?市)(.*?市)", "g"); result = patt.exec(str); if (result == null) { patt = new RegExp("(.*?省)(.*?市)(.*县)", "g"); result = patt.exec(str); if (result != null) { s_region[0] = result[1]; s_region[1] = result[2]; s_region[2] = result[3]; dol_path = path.replace(result[0], ''); } } else { s_region[0] = result[1]; s_region[1] = result[2]; s_region[2] = result[3]; dol_path = path.replace(result[0], ''); } } else { s_region[0] = result[1]; s_region[1] = result[2]; s_region[2] = result[3]; dol_path = path.replace(result[0], ''); } var filename = dol_path + e.name; let addr_detail = filename; let address_component = ''; locat.getGpsLocation(e.latitude, e.longitude).then((res) => { address_component = res; if (address_component) { s_region[0] = address_component.province; s_region[1] = address_component.city; s_region[2] = address_component.district; addr_detail = filename || address_component.street; } that.setData({ region: s_region, lon_lat: lon_lat, addr_detail }) }); if (s_region[0] == '省') { wx.showToast({ title: '请重新选择省市区', icon: 'none', }) } }, fail: function(e) { wx.showToast({ title: '地址获取失败', icon: 'none', }) console.log('地址获取失败', e) } }) },
2023-10-19