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


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM