如题,安卓下可以正常获取,ios端获取失败
wx.config({
debug: false,
appId: weixinShare.appId,
timestamp: weixinShare.timestamp,
nonceStr: weixinShare.nonceStr,
signature: weixinShare.signature,
jsApiList: ["getLocation", "openLocation"]
});
// eslint-disable-next-line no-undef
wx.ready(() => {
// eslint-disable-next-line no-undef
wx.getLocation({
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
that.getAddress(latitude, longitude);
},
fail: function(res) {
that.$Message.warning("获取位置信息失败");
that.addRecord();
}
});
});
获取定位不需要https协议,iOS获取失败是不是系统权限没有给?