Article Directory
I. Description of the problem
Had a small micro-channel program development experience would know, part of the user interface requires little program license agreement can call the applet will pop asking the user first use, but once the user denying authorization, then the next click will not emergence of pop inquiry. No pop inquiry, authorized users how to retrieve it? Below to access local album authorization, for example , to re-introduce two types of method for obtaining user authorization.
Second, the micro-channel user's solution
1. Method One: After you remove the small micro-channel program to re-enter the search applet.
Micro letter applet authorization is valid (once the user's explicit consent or refused authorization, the delegation relationship will be recorded in the background until the user actively Remove applet.) Therefore, if a user actively Remove applet search again enter, can occur reauthorization the inquiry pop. At this small cache information program include all states are authorized will be reset.
2. Method Two: Go authorization settings page to activate the authorization.
Click on the top right corner of the small program "..." button -> Settings and enter the authorization settings page open authorization.
Third, the pop prompts guide the user to open the authorization
When the monitored user denies authorization, a prompt dialog box pops up when the user clicks OK, the automatic switch Skip authorization settings page, enabling users to open the boot authorization.
Fourth, the reference code
In the interface calls fail fail callback function , the write wx.showModal prompt box , go to guide the user authorization settings page to activate authorized by wx.openSetting () when the user clicks OK.
wx.saveImageToPhotosAlbum({
success: function (res) {
if (res.authSetting['scope.writePhotosAlbum']) {
// 已经授权访问本地相册
}
},
fail:function(e){
wx.showModal({
title: '提示',
content: '用户拒绝授权访问本地相册将导致头像无法保存!如需继续操作,请点击确定前往开启授权。',
success: function (res) {
if (res.confirm) {//点击确定后前往授权设置页面
wx.openSetting()
}
}
})
}
})