确定是否设置了对照片库的访问权限 - PHPhotoLibrary [英] Determine if the access to photo library is set or not - PHPhotoLibrary

查看:1489
本文介绍了确定是否设置了对照片库的访问权限 - PHPhotoLibrary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用iOS 8中的新功能,如果您在应用程序中使用相机,它将要求访问相机的权限,然后当您尝试重新拍摄照片时,它会要求获得访问照片库的权限。下次启动应用程序时,我希望检查相机和照片库是否具有访问权限。

With the new functionality in iOS 8, if you are using a camera in the app, it will ask for permission to access the camera and then when you try to retake the pic, it asks for permission to access photo library. Next time when I launch the app, I wish to check if the camera and photo library has access permissions to it.

对于相机,我通过

if ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusDenied)
{
// do something
}

我正在为照片库寻找类似的东西。

I am looking for something similar to this for photo library.

推荐答案

检查 + [PHPhotoLibrary authorizationStatus] - 如果没有设置,它将返回 PHAuthorizationStatusNotDetermined 。 (然后,您可以在同一个类上使用 + requestAuthorization:请求访问。)

Check +[PHPhotoLibrary authorizationStatus] – if not set, it will return PHAuthorizationStatusNotDetermined. (You can then request access using +requestAuthorization: on the same class.)

这篇关于确定是否设置了对照片库的访问权限 - PHPhotoLibrary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆