wx.authorize失效,错误码为12006

touchstart() {
                wx.getSetting({
                    success(res) {
                        if (!res.authSetting['scope.record']) {
                            wx.authorize({
                                scope: 'scope.record',
                                success() {// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
                                    wx.startRecord({
                                        success(res) {
                                            const tempFilePath = res.tempFilePath
                                            console.log(tempFilePath, '文件')
                                        }
                                    })
                                },
                                fail(error) {
                                    console.log(error, '获取录音授权失败!')
                                }
                            })
                        }
                    }
                })
            },

 

先说一下出现这个情况的原因,第一次拒绝授权之后,后面在拉取录音的权限时就没有反应了,错误码为12006


要么清除小程序缓存,要么提示用户手动到设置里面开启权限

posted @ 2021-06-30 18:03  龙卷风吹毁停车场  阅读(1072)  评论(0编辑  收藏  举报