iOS关于相机相册权限设置,为何会被拒

大礼包 5.1.1

Thank you for your resubmission. We found that your app is still not in compliance with the App Store Review Guidelines.

Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage

We noticed that your app requests the user’s consent to access their camera but does not clarify the use of this feature in the permission modal alert.

Next Steps

To resolve this issue, please revise the permission modal alert to specify why the app is requesting access to the user's camera.

The permission request alert should specify how your app will use this feature to help users understand why your app is requesting access to their personal data.

Resources

For additional information and instructions on configuring and presenting an alert, please review the Requesting Permission section of the iOS Human Interface Guidelines and the Information Property List Key Reference. You may also want to review the Technical Q&A QA1937: Resolving the Privacy-Sensitive Data App Rejection page for details on how to provide a usage description for permission request alerts.

Learn more about Protecting the User’s Privacy.

Please see attached screenshots for details.

attachment-2103903871843651145Screenshot-0910-100004.png

按各位朋友的建议,先设置plist 啦,这是毫无疑问的。

iOS 10 相机、相册的权限设置在Info.plist中设置,如果在你Info.plist中没有设置该权限的话,那么你运行你的程序调用相机时就会莫名奇妙没有任何征兆的的崩溃。具体设置步骤如下图:
image

然后就是要先设置权限了。这一步是重点,这一步是重点,这一步是重点。

引入AVFoundation 和Photos框架:

#import <AVFoundation/AVCaptureDevice.h>
#import <Photos/Photos.h>

-(void)showActionBeforeAccessAlbum{
    debugMethod();


    PHAuthorizationStatus photoStatus = [PHPhotoLibrary authorizationStatus];


    if (photoStatus==PHAuthorizationStatusAuthorized ) {
        [self takeAlbum];
    }else{
        [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
            dispatch_async(dispatch_get_main_queue(), ^{
                switch (status) {
                    case PHAuthorizationStatusAuthorized: //已获取权限

                        [self takeAlbum];
                        break;

                    case PHAuthorizationStatusDenied: //用户已经明确否认了这一照片数据的应用程序访问

                        [self.view makeToast:@"访问权限受限,请到设置里设置权限"];
                        break;

                    case PHAuthorizationStatusRestricted://此应用程序没有被授权访问的照片数据。可能是家长控制权限
                        [self.view makeToast:@"此应用程序没有被授权访问的照片数据。可能是家长控制权限"];

                        break;

                    default://其他。。。
                        break;
                }
            });
        }];
    }

}


-(void)takeAlbum
{
    
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.navigationBar.translucent = NO;

    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.delegate = self;
    //设置选择后的图片可被编辑
    picker.allowsEditing = YES;
    [self presentViewController:picker animated:YES completion:nil];
    
}

-(void)showactionForImageUpladtFromCamera{
    debugMethod();


    NSString *mediaType = AVMediaTypeVideo;//读取媒体类型
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];//读取设备授权状态
    if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
        NSString *errorStr = @"应用相机权限受限,请在设置中启用";
        //        [[HUDHelper getInstance] showErrorTipWithLabel:errorStr view:self.navigationController.view];

        [self.view makeToast:errorStr];
        return;
    }else if (authStatus ==AVAuthorizationStatusNotDetermined){


        [self showAlertWithTitle:@"上传头像需要相机访问权限" Message:nil CancelTitle:nil OthersTitles:@[@"明白了"] ConfirmHandel:^(NSInteger index) {

            [self takePhoto];

        }];

    }else{

        [self takePhoto];

    }


}
-(void)takePhoto
{




    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
    if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.delegate =self;
        picker.navigationBar.translucent = NO;

        //设置拍照后的图片可被编辑
        picker.allowsEditing = YES;
        picker.sourceType = sourceType;
        
        [self presentViewController:picker animated:YES completion:nil];
    }else
    {
     }
    
    
    
}
全部评论

相关推荐

最近拿到了正浩的提前批offer感觉自己的实力得到了肯定,也给了我更多底气
搞机墨镜猫:正浩提前批官网好像就只有电力电子软硬件,哥们投的是这两个岗位吗
26届校招投递进展
点赞 评论 收藏
分享
05-26 10:24
门头沟学院 Java
qq乃乃好喝到咩噗茶:其实是对的,线上面试容易被人当野怪刷了
找工作时遇到的神仙HR
点赞 评论 收藏
分享
07-17 12:07
门头沟学院 Java
勇敢牛牛不怕困难
投递OPPO等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务