相册,相机,通讯录访问权限标准写法
来源:互联网 发布:itunes软件下载 编辑:程序博客网 时间:2024/05/21 18:43
@implementation OTUniversalMethod (VisitDevice)
- (BOOL)isAvailablyForAlbum {
ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];
if (author ==ALAuthorizationStatusRestricted || author ==ALAuthorizationStatusDenied){
NSString *appName = [[[NSBundlemainBundle] infoDictionary]objectForKey:@"CFBundleName"];
NSString *msg = [NSStringstringWithFormat:@"请在iPhone的“设置”-“隐私”-“照片”选项中,允许%@访问你的照片。",appName];
UIAlertView * alert = [[UIAlertViewalloc]initWithTitle:@"相册服务未开启"message:msg delegate:nilcancelButtonTitle:@"取消"otherButtonTitles:@"立即开启",nil];
alert.delegate =self;
alert.tag =HOS_ALERT_TAG_ALBUM;
[alert show];
returnNO;
}
returnYES;
}
- (BOOL)isAvailablyForCamera {
AVAuthorizationStatus authStatus = [AVCaptureDeviceauthorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus ==AVAuthorizationStatusRestricted ||
authStatus == AVAuthorizationStatusDenied ) {
NSString* msg = [NSStringstringWithFormat:@"请在“设置”-“隐私”-“相机”选项中,允许%@访问你的相机。",[[[NSBundlemainBundle] infoDictionary]objectForKey:@"CFBundleName"]];
UIAlertView *alterView = [[UIAlertViewalloc] initWithTitle:@"相机服务未开启"message:msg delegate:nilcancelButtonTitle:@"取消"otherButtonTitles:@"立即开启",nil];
alterView.delegate =self;
alterView.tag =HOS_ALERT_TAG_CAMERA;
[alterView show];
returnNO;
}
returnYES;
}
- (BOOL)isAvailablyForAddressBook {
ABAuthorizationStatus authStatus =ABAddressBookGetAuthorizationStatus();
if(authStatus ==kABAuthorizationStatusRestricted || authStatus ==
kABAuthorizationStatusDenied){
NSString* msg = [NSStringstringWithFormat:@"请在“设置-隐私-通讯录”选项中,允许%@访问你的通讯录。",[[[NSBundlemainBundle] infoDictionary]objectForKey:@"CFBundleName"]];
UIAlertView *alterView = [[UIAlertViewalloc] initWithTitle:@"相机服务未开启"message:msg delegate:nilcancelButtonTitle:@"取消"otherButtonTitles:@"立即开启",nil];
alterView.delegate =self;
alterView.tag =HOS_ALERT_TAG_ADDRESSBOOK;
[alterView show];
returnNO;
}
returnYES;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag ==HOS_ALERT_TAG_ALBUM) {
if (buttonIndex ==1) {
if(IOS8_And_Later){
if ([[UIApplicationsharedApplication] canOpenURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]]) {
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]];
}
}
}
}
if (alertView.tag ==HOS_ALERT_TAG_CAMERA) {
if (buttonIndex ==1) {
if(IOS8_And_Later){
if ([[UIApplicationsharedApplication] canOpenURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]]) {
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]];
}
}
}
}
if (alertView.tag ==HOS_ALERT_TAG_ADDRESSBOOK) {
if (buttonIndex ==1) {
if(IOS8_And_Later){
if ([[UIApplicationsharedApplication] canOpenURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]]) {
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:UIApplicationOpenSettingsURLString]];
}
}
}
}
}
@end
- 相册,相机,通讯录访问权限标准写法
- iOS相册、相机、通讯录权限获取
- iOS相册、相机、通讯录权限获取
- iOS 相机权限以及相册权限访问
- iOS相机,相册等访问权限
- iOS-相机,相册,位置访问权限设置
- iOS10获取相册/通讯录/相机/麦克风权限崩溃解决办法
- 升级iOS10后访问相机、相册、麦克风、通讯录闪退
- iOS10访问通讯录、相册等隐私权限设置
- iOS之访问(隐私)权限设置 通讯录、相册、麦克风等
- iOS 相册相机权限
- 相册 相机 权限
- 判断是否有权限访问相机,相册,定位
- 判断是否有权限访问相机,相册,定位
- 判断是否有权限访问相机,相册,定位
- 判断是否有权限访问相机,相册,定位
- iOS判断是否有权限访问相机,相册,定位
- 判断应用是否有访问相册和相机的权限
- Tensorflow:terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
- 通过网络获取图片,最终转码出来的图片显示不全
- EA&UML日拱一卒-关联(限定关联)
- 我的笔记 多态
- ABAP 基础
- 相册,相机,通讯录访问权限标准写法
- HTTP Status 500
- @RequestMapping 用法详解之地址映射
- Marp--程序员的专属PPT
- 巧用border属性兼容ie8圆角问题
- Codeforces Round #408 (Div. 2) B.Find The Bone(模拟)
- IPC-进程间通信(一)Messager
- 使用XHProf查找PHP性能瓶颈
- SQL 执行计划的理解