123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //
- // LBXPermission.h
- // LBXKits
- // https://github.com/MxABC/LBXPermission
- // Created by lbx on 2017/9/7.
- // Copyright © 2017年 lbx. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import "LBXPermissionSetting.h"
- typedef NS_ENUM(NSInteger,LBXPermissionType)
- {
- LBXPermissionType_Camera,
- LBXPermissionType_Photos
- };
- @interface LBXPermission : NSObject
- /**
- whether permission has been obtained, only return status, not request permission
- for example, u can use this method in app setting, show permission status
- in most cases, suggest call "authorizeWithType:completion" method
- @param type permission type
- @return YES if Permission has been obtained,NO othersize
- */
- + (BOOL)authorizedWithType:(LBXPermissionType)type;
- /**
- request permission and return status in main thread by block.
- execute block immediately when permission has been requested,else request permission and waiting for user to choose "Don't allow" or "Allow"
- @param type permission type
- @param completion May be called immediately if permission has been requested
- granted: YES if permission has been obtained, firstTime: YES if first time to request permission
- */
- + (void)authorizeWithType:(LBXPermissionType)type completion:(void(^)(BOOL granted,BOOL firstTime))completion;
- @end
|