ios11中, 访问相机和相册的权限问题


/* ios 11 */

[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {

        if (status == PHAuthorizationStatusNotDetermined || status == PHAuthorizationStatusAuthorized) {

            [selfshowActionView];

        }else{

            dispatch_async(dispatch_get_main_queue(), ^{

                [self.parentControllershowMessageHUD:@"请打开摄像头和相册权限"];

            });

        }

    }];


/*  ios 10 和 ios10以下 */ 

    PHAuthorizationStatus photoAuthorizationStatus = [PHPhotoLibrary authorizationStatus];

    switch(photoAuthorizationStatus) {

        casePHAuthorizationStatusAuthorized:

            {

                [selfshowActionView];

                break;

            }

        default:

        {

            [self.parentController showMessageHUD:@"请打开摄像头和相册权限"];

            break;

        }

    }

你可能感兴趣的:(ios11中, 访问相机和相册的权限问题)