上线版本 真机关于获取地址之后保存到本地 再去获取没有找到 但是在测试环境中可以找到,
//,这是获取时的代码
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
success: function(res) {
console.log('获取地理位置!');
console.log(res);
// _this.setData({
// 'SerchModule.address': res.address.slice(0, res.address.indexOf('省')+1),
// })
qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success: function(res) {
console.log(res);
_this.setData({
'SerchModule.address': res.result.ad_info.district || res.result.ad_info.city
})
wx.setStorageSync('MyPosition', res);
},
fail: res => {
//接口调用失败,提示用户打开定位功能
this.wetoast.toast({
title: '获取定位失败,请打开定位,重新进入!'
});
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userLocation']) {
wx.authorize({
scope: 'scope.userLocation',
success(res) {
console.log(res);
// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
// wx.startRecord()
}
})
}
}
})
}
})
}
}) // 这是找本地保存的数据的代码
MyPosition: wx.getStorageSync('MyPosition'),

哎呦我去,易洋千玺的优秀的粉丝好多呀~~ 我还以为来微博了呢
有没有代码片段链接提供?有可能是自己代码写错了
wx.getLocation({type:'gcj02',//返回可以用于wx.openLocation的经纬度success:function(res) {console.log('获取地理位置!');console.log(res);// _this.setData({// 'SerchModule.address': res.address.slice(0, res.address.indexOf('省')+1),// })qqmapsdk.reverseGeocoder({location: {latitude: res.latitude,longitude: res.longitude},success:function(res) {console.log(res);_this.setData({'SerchModule.address': res.result.ad_info.district || res.result.ad_info.city})wx.setStorageSync('MyPosition', res);},fail: res => {//接口调用失败,提示用户打开定位功能this.wetoast.toast({title:'获取定位失败,请打开定位,重新进入!'});wx.getSetting({success(res) {if(!res.authSetting['scope.userLocation']) {wx.authorize({scope:'scope.userLocation',success(res) {console.log(res);// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问// wx.startRecord()}})}}})}})}})地址什么的我都可以获取到![]()
我在测试版本上 也没有问题 到上线版本 就获取不到
在体验版打开调试,再打开线上版本也能看到 v console。建议在 vconsole 调试看下是哪个地方出了问题,有没有错误详情。
调试的时候不报错 上线版本地址没有获取到 我的部分界面没有显示
@娇华