#import <AssetsLibrary/AssetsLibrary.h>
ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];
if (author == kCLAuthorizationStatusRestricted || author ==kCLAuthorizationStatusDenied)
{
//无权限
}
typedef enum {
kCLAuthorizationStatusNotDetermined = 0, // 用户尚未做出选择这个应用程序的问候
kCLAuthorizationStatusRestricted, // 此应用程序没有被授权访问的照片数据。可能是家长控制权限
kCLAuthorizationStatusDenied, // 用户已经明确否认了这一照片数据的应用程序访问
kCLAuthorizationStatusAuthorized // 用户已经授权应用访问照片数据
} CLAuthorizationStatus;
2.判断用户是否有权限访问相机
iOS7之前都可以访问相机,iOS7之后访问相机有权限设置
#import <AVFoundation/AVCaptureDevice.h>
#import <AVFoundation/AVMediaFormat.h>
AVAuthorizationStatus authStatus = [AVCaptureDeviceauthorizationStatusForMediaType:AVMediaTypeVideo];
if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
{
//无权限
}
3.判断是否开启定位服务
[CLLocationManagerlocationServicesEnabled] //检测的是整个的iOS系统的定位服务是否开启
检测当前应用的定位服务是否开启需要通过一下方法来检测
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error