wx.openSetting iphone6s,iphone7无效
发布于 5 年前 作者 juanwei 11813 次浏览 来自 问答

iphone6s  iphone7无效,安卓的可以。

ios: 10.3.2    wechat:6.5.12

wechatlib:1.4.4

小程序编译:1.1.0

refLoadAuthorize:function(succ,fail){

    var that = this;

    if(wx.openSetting){

      console.log(‘wx.openSetting load’);//这里可以打印出来,后面就没有反应,也不报错

 

      wx.openSetting({

        success: (res)=> {

          console.log(‘success’,res);

          if (res.authSetting[“scope.userInfo”]) {

            that.getUserInfo();

            if (typeof succ == ‘function’) succ();

          }

          else

          {

            if (typeof fail == ‘function’) fail();

          }

          if (res.authSetting[“scope.userLocation”]){

            that.getLocation();

          }

        },

        fail :(res)=>{

          console.log(‘fail’,res);

        },

        complete:(res)=>{

          console.log(‘complete’,res);

        }

      });

    } else {

      console.log(‘不支持wx.openSetting’);

      wx.showModal({

        title: ‘提示’,

        content: “您的微信版本过低,不支持再次授权,请删除小程序重新打开,授权请点击‘允许’”,

        showCancel: false,

        confirmText: ‘确定’

      });

    }

  },

4 回复

按照官方回复的可以完成。

遇到同样的问题

是啊,就是这完成方式太过hack,让人纠结!

在Page的生命周期函数中调用目前有些问题,后续版本会修复。可以先setTimeout延时调用。

回到顶部