微信网页开发 ios调用 wx.getLocation 需要https协议嘛?
发布于 6 年前 作者 tao48 11444 次浏览 来自 问答

如题,安卓下可以正常获取,ios端获取失败

wx.config({
            debugfalse,
            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'
              successfunction(res{
                var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
                var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
                that.getAddress(latitude, longitude);
              },
              failfunction(res{
                that.$Message.warning("获取位置信息失败");
                that.addRecord();
              }
            });
          });
1 回复

获取定位不需要https协议,iOS获取失败是不是系统权限没有给?

回到顶部