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];
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值