小程序个人开发者是无法获取录音授权吗?
发布于 4 年前 作者 yongyan 8524 次浏览 来自 官方Issues
个人开发者开发小程序使用下面的代码获取录音权限一直报错
        wx.getSetting({
      success(res) {
        if (!res.authSetting['scope.record']) {
          console.log('record')
          wx.authorize({
            scope'scope.record',
            success() {
              console.log('record')
            },
            fail(err) {
              console.error(err)
            }
          })
        }
      },
      fail(){
        console.log('fail')
      }
    })

报错信息:
{errMsg: "authorize:fail 系统错误,错误码:-12006,auth deny"}
1 回复

你好,wx.authorize如果用户在弹窗拒绝授权了就会在fail回调中就会提示 拒绝授权相关的信息,

可以使用 wx.authorize 改成:wx.openSetting 让用户在设置页进行修改录音(record)的权限,参考文档:

https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008

回到顶部