微信小程序在开发者工具上可以获取到地理位置,但是在微信中获取不到地理位置,是什么原因呢?
wx.getLocation({
type: 'wgs84',
altitude: false,
success: (res) => {
that.setData({
latitude: res.latitude,
longitude: res.longitude
})
let locationString = res.latitude + "," + res.longitude;
wx.request({
url: 'http://apis.map.qq.com/ws/geocoder/v1/',
data: {
"key": "ABCDEFHJ,KL",
"location": locationString
},
method: 'GET',
success: function (res) {
that.setData({
position: res.data.result.address_component.street_number
})
}
});
},
fail: () => {
},
complete: () => { }
});
你好,建议打印fail或者complete回调自查。