iOS10 关于相机相册崩溃问题

< 相册 >
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需要您的同意,才能访问媒体资料库
info.plist中逐个添加 **KEY直接复制 value的string字符串就是提示的文字 可以根据自己需要填写。
*特别注意:键值对不能为空*
**
这里写图片描述

//相机权限
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];
}
}

猜你喜欢

转载自blog.csdn.net/macro_sn/article/details/52885960