ios 对系统相册、相机、麦克风授权的简易工具
ios 对系统相册、相机、麦克风授权的简易工具
Swift 其它杂项
共7Star
详细介绍
1.使用方法,以获取系统相册权限为例
// 检测当前应用是否获取相册权限
BOOL photoAuth = [GKAuthorizationTool checkAuthorizationWithType:GKAuthorizationTypePhoto];
if (photoAuth) {
// 已经授权
}else{ // 未授权
// 开始授权,获取授权状态
GKAuthorizationStatus status = [GKAuthorizationTool getPhotoAuthorizationStatus];
if (status == GKAuthorizationStatusNotDetermined) { // 未授权过
[GKAuthorizationTool requestPhotoAuthorizationCallback:^(GKAuthorizationStatus status) {
if (status == GKAuthorizationStatusAuthorized){
// 授权成功
}else{
// 授权失败
}
}];
}else{ // 已授权过,后又关闭权限,直接跳转到系统设置中该应用的授权界面
[self openSettingURL];// 打开系统设置该应用授权界面
}
}
2.支持CocoaPods
pod 'GKAuthorizatonTool'
3.更新日志
1.0.0:支持相册、相机、麦克风授权,更新日期:2016.8.23
-
0 Star
-
0 Star
-
1872 Star
-
1283 Star
-
0 Star
-
0 Star
-
0 Star
-
8 Star
-
46 Star