IOS 权限键值

NSPhotoLibraryUsageDescription;App需要您的同意,才能访问相册NSCameraUsageDescription;App需要您的同意,才能访问相机NSMicrophoneUsageDescription;App需要您的同意,才能访问麦克风NSLocationUsageDescription;App需要您的同意,才能访问位置NSLocationWhenInUseUsageDescription;App需要您的同意,才能在使用期间访问位置

NSLocationAlwaysUsageDescription;App需要您的同意,才能始终访问位置NSCalendarsUsageDescription;App需要您的同意,才能访问日历NSRemindersUsageDescription;App需要您的同意,才能访问提醒事项NSMotionUsageDescription;App需要您的同意,才能访问运动与健身NSHealthUpdateUsageDescription;App需要您的同意,才能访问健康更新NSHealthShareUsageDescription;App需要您的同意,才能访问健康分享NSBluetoothPeripheralUsageDescription;App需要您的同意,才能访问蓝牙NSAppleMusicUsageDescription;App需要您的同意,才能访问媒体资料库

//相机权限

AVAuthorizationStatus authStatus = [AVCaptureDeviceauthorizationStatusForMediaType:AVMediaTypeVideo];

if (authStatus ==AVAuthorizationStatusRestricted ||authStatus ==AVAuthorizationStatusDenied)  //用户已经明确否认了这一照片数据的应用程序访问

{

// 无权限 引导去开启

NSURL *url = [NSURLURLWithString:UIApplicationOpenSettingsURLString];

if ([[UIApplicationsharedApplication]canOpenURL:url]) {

[[UIApplicationsharedApplication]openURL:url];

}

}

//相册权限

ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];

if (author ==kCLAuthorizationStatusRestricted || author ==kCLAuthorizationStatusDenied){

//无权限 引导去开启

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

if ([[UIApplication sharedApplication] canOpenURL:url]) {

[[UIApplication sharedApplication] openURL:url];

}

}

你可能感兴趣的:(IOS 权限键值)