收藏
回答

网页获取位置报错the permission value is offline verifying?

官方的方法已经尝试过。config方法正确,在ready方法里检查api,然后才执行回调。

https://developers.weixin.qq.com/community/develop/doc/000a24a11e8c786fdf29b6dc659c09?highLine=the%2520permission%2520value%2520is%2520offline%2520verifying

wx.config({
    beta: true, 
    debug: false, 
    appId, 
    timestamp: Number(timestamp), 
    nonceStr, 
    signature, 
    jsApiList: ['chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getLocalImgData',
        'openLocation', 'getLocation'] 
});
wx.ready(() => {
    console.log('初始化js-sdk成功');
    wx.checkJsApi({
        jsApiList: ['getLocation'],
        success(res) {
            if (res.checkResult.getLocation === false) {
                const message = '你的微信版本太低,不支持微信JS接口,请升级到最新的微信版本!'
                reject(message);
            } else {
                const message = 'js-sdk检查成功';
                console.log(message);
                resolve(message);
            }
        },
        fail(res) {
            const message = 'checkJsApi fail=' + JSON.stringify(res);
            console.log(message);
            reject(message);
        }
    });
});

回答关注问题邀请回答
收藏
登录 后发表内容
问题标签