iOS 相册使用过程中的 状态选择 PHAuthorizationStatus

if ([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusAuthorized) {

                UIAlertView *alerView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请在iPhone'设置-隐私-照片'选项中,允许不囧访问你的相册" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

                [alerView show];

                return;

            }

            [self imagePickerWithSourceType:UIImagePickerControllerSourceTypePhotoLibrary];


可以设置一下做下判断


另外集中风格说明


- (IBAction)save {
    // 0.判断状态
    PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
    if (status == PHAuthorizationStatusDenied) {
        BSLog(@"用户拒绝当前应用访问相册,我们需要提醒用户打开访问开关");
    }else if (status == PHAuthorizationStatusRestricted){
        BSLog(@"家长控制,不允许访问");
    }else if (status == PHAuthorizationStatusNotDetermined){
        BSLog(@"用户还没有做出选择");
        [self saveImage];
    }else if (status == PHAuthorizationStatusAuthorized){
        BSLog(@"用户允许当前应用访问相册");
        [self saveImage];
    }
}

你可能感兴趣的:(iOS 相册使用过程中的 状态选择 PHAuthorizationStatus)