Latest 1.0.5
Homepage https://github.com/MxABC/LBXPermission
License MIT
Platforms ios 7.0, requires ARC
Authors

LBXPermission


iOS常用权限获取

image

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

//相机权限获取,已经有权限了,仍然可通过该接口返回状态
    [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

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

install manually

drag folder "LBXPermissions" to your project

备注

demo界面待修改

Latest podspec

{
    "name": "LBXPermission",
    "version": "1.0.5",
    "summary": "iOS permissions",
    "homepage": "https://github.com/MxABC/LBXPermission",
    "license": "MIT",
    "authors": {
        "lbxia": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/MxABC/LBXPermission.git",
        "tag": "1.0.5"
    },
    "requires_arc": true,
    "default_subspecs": "All",
    "subspecs": [
        {
            "name": "All",
            "source_files": "LBXPermissions/*.{h,m}"
        },
        {
            "name": "Base",
            "source_files": [
                "LBXPermissions/LBXPermissionSetting.{h,m}",
                "LBXPermissions/LBXPermission.{h,m}"
            ]
        },
        {
            "name": "Camera",
            "source_files": "LBXPermissions/LBXPermissionCamera.{h,m}"
        },
        {
            "name": "Photo",
            "source_files": "LBXPermissions/LBXPermissionPhotos.{h,m}"
        },
        {
            "name": "Contact",
            "source_files": "LBXPermissions/LBXPermissionContacts.{h,m}"
        },
        {
            "name": "Location",
            "source_files": "LBXPermissions/LBXPermissionLocation.{h,m}"
        },
        {
            "name": "Reminder",
            "source_files": "LBXPermissions/LBXPermissionReminders.{h,m}"
        },
        {
            "name": "Calendar",
            "source_files": "LBXPermissions/LBXPermissionCalendar.{h,m}"
        },
        {
            "name": "Microphone",
            "source_files": "LBXPermissions/LBXPermissionMicrophone.{h,m}"
        },
        {
            "name": "Health",
            "source_files": "LBXPermissions/LBXPermissionHealth.{h,m}"
        },
        {
            "name": "Net",
            "source_files": [
                "LBXPermissions/LBXPermissionNet.{h,m}",
                "LBXPermissions/NetReachability.{h,m}",
                "LBXPermissions/LBXPermissionData.{h,m}"
            ]
        }
    ]
}

Pin It on Pinterest

Share This