lbx

LBXPermission

iOS常用权限请求判断

Showing:

Popularity

Downloads/wk

0

GitHub Stars

407

Maintenance

Last Commit

5mos ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

LBXPermission


iOS常用权限获取

1112.gif

调用接口简单,易用,如下面相机和定位权限判断及获取

//相机权限获取,已经有权限了,仍然可通过该接口返回状态
    [LBXPermission authorizeWithType:LBXPermissionType_Camera completion:^(BOOL granted, BOOL firstTime) {
     
        if (granted) {
            //TODO
            //dosth
        }
        else if (!firstTime)
        {
            //不是第一次请求权限,那么可以弹出权限提示,用户选择设置,即跳转到设置界面,设置权限
             [LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"提示" msg:@"没有相机权限,是否前往设置" cancel:@"取消" setting:@"设置"];
        }
    }];
    
    
    //定位
    [LBXPermission authorizeWithType:LBXPermissionType_Location completion:^(BOOL granted, BOOL firstTime) {
        
        if (granted) {
            //TODO
            //dosth
        }
        else if (!firstTime)
        {
            //不是第一次请求权限,那么可以弹出权限提示,用户选择设置,即跳转到设置界面,设置权限
            [LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"提示" msg:@"没有定位权限,是否前往设置" cancel:@"取消" setting:@"设置"];
        }
    }];

install by cocoapods

没有使用到的权限,不要安装,否则Appstore审核不通过

   pod 'LBXPermission/Base'
   pod 'LBXPermission/Camera'
   pod 'LBXPermission/Photo'
   pod 'LBXPermission/Contact'
   pod 'LBXPermission/Location'
   pod 'LBXPermission/Reminder'
   pod 'LBXPermission/Calendar'
   pod 'LBXPermission/Microphone'
   pod 'LBXPermission/Health'
   pod 'LBXPermission/Net'
   pod 'LBXPermission/Tracking' 
   pod 'LBXPermission/Notification'
   pod 'LBXPermission/Bluetooth'

install manually

将 "LBXPermissions" 文件夹拖动你的工程,并删除非必要的权限文件

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100