LBXPermission.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // LBXPermission.h
  3. // LBXKits
  4. // https://github.com/MxABC/LBXPermission
  5. // Created by lbx on 2017/9/7.
  6. // Copyright © 2017年 lbx. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "LBXPermissionSetting.h"
  10. typedef NS_ENUM(NSInteger,LBXPermissionType)
  11. {
  12. LBXPermissionType_Camera,
  13. LBXPermissionType_Photos
  14. };
  15. @interface LBXPermission : NSObject
  16. /**
  17. whether permission has been obtained, only return status, not request permission
  18. for example, u can use this method in app setting, show permission status
  19. in most cases, suggest call "authorizeWithType:completion" method
  20. @param type permission type
  21. @return YES if Permission has been obtained,NO othersize
  22. */
  23. + (BOOL)authorizedWithType:(LBXPermissionType)type;
  24. /**
  25. request permission and return status in main thread by block.
  26. execute block immediately when permission has been requested,else request permission and waiting for user to choose "Don't allow" or "Allow"
  27. @param type permission type
  28. @param completion May be called immediately if permission has been requested
  29. granted: YES if permission has been obtained, firstTime: YES if first time to request permission
  30. */
  31. + (void)authorizeWithType:(LBXPermissionType)type completion:(void(^)(BOOL granted,BOOL firstTime))completion;
  32. @end