yoggexu
yoggexu
  • 发布:2019-05-09 14:22
  • 更新:2019-05-09 14:22
  • 阅读:3195

ios 用户拒绝 相册访问 ,引导用户 到 设置页面,开启 相册访问权限

分类:uni-app
                            uni.chooseImage({  
                    count: 1,  
                    sizeType: ['original', 'compressed'],  
                    sourceType: ['album'],  
                    success: res => {  
                        console.log(res)  
                    },  
                    fail: err => {  
                        console.log('选择图片失败!')  
                        // #ifdef APP-PLUS  
                          if(plus.os.name == 'iOS') {  
                              var PHPhotoLibrary = plus.ios.importClass('PHPhotoLibrary')  
                              var PHAuthorizationStatus = PHPhotoLibrary.authorizationStatus()  
                              if(PHAuthorizationStatus != 3 ) {  
                                 uni.showModal({  
                                    content: '需要访问您的相册,请在设置里开启',  
                                    confirmText: '设置',  
                                    success: res => {  
                                        if(res.confirm) {  
                                            plus.runtime.openURL('app-settings://')  
                                        }  
                                    }  
                                 });   
                              }  
                          }  
                        // #endif  
                        console.log(JSON.stringify(err))  
                    }  
                })  
0 关注 分享

要回复文章请先登录注册