访问权限0630 2016
Posted zhen_zhen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了访问权限0630 2016相关的知识,希望对你有一定的参考价值。
//相册
#import <AssetsLibrary/AssetsLibrary.h>
- ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];
- if (author == kCLAuthorizationStatusRestricted || author ==kCLAuthorizationStatusDenied){
- //无权限
- }
//gzz0630 照相机
NSString * mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authorizationStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
if (authorizationStatus == AVAuthorizationStatusRestricted|| authorizationStatus == AVAuthorizationStatusDenied) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"相机访问受限" message:@"请在“设置-隐私-相机”选项中允许肝胆相照访问你的相机" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
[alertView show];//gzz0630
}else{}
//录音
AVAudiosession *avSession = [AVAudioSession sharedInstance];
if ([avSession respondsToSelector:@selector(requestRecordPermission:)]) {
[avSession requestRecordPermission:^(BOOL available) {
if (available) {
if (self.playVoiceMessage) {
}
else
{
dispatch_async(dispatch_get_main_queue(), ^{//gzz0630
[[[UIAlertView alloc] initWithTitle:@"无法录音" message:@"请在“设置-隐私-麦克风”选项中允许肝胆相照访问你的麦克风" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show];
});
}
}];
}
以上是关于访问权限0630 2016的主要内容,如果未能解决你的问题,请参考以下文章