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 
#import 

-(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
    {
     }
    
    
    
}

你可能感兴趣的:(iOS关于相机相册权限设置,为何会被拒)