BMKLocationAuth.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // BMKLocationAuth.h
  3. // LocationComponent
  4. //
  5. // Created by baidu on 2017/4/10.
  6. // Copyright © 2017年 baidu. All rights reserved.
  7. //
  8. #ifndef BMKLocationAuth_h
  9. #define BMKLocationAuth_h
  10. ///定位鉴权错误码
  11. typedef NS_ENUM(NSInteger, BMKLocationAuthErrorCode) {
  12. BMKLocationAuthErrorUnknown = -1, ///< 未知错误
  13. BMKLocationAuthErrorSuccess = 0, ///< 鉴权成功
  14. BMKLocationAuthErrorNetworkFailed = 1, ///< 因网络鉴权失败
  15. BMKLocationAuthErrorFailed = 2, ///< KEY非法鉴权失败
  16. };
  17. ///通知Delegate
  18. @protocol BMKLocationAuthDelegate <NSObject>
  19. @optional
  20. /**
  21. *@brief 返回授权验证错误
  22. *@param iError 错误号 : 为0时验证通过,具体参加BMKLocationAuthErrorCode
  23. */
  24. - (void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError;
  25. @end
  26. ///BMKLocationAuth类。用于鉴权
  27. @interface BMKLocationAuth : NSObject
  28. ///鉴权状态0:成功; 1:网络错误; 2:授权失败
  29. @property(nonatomic, readonly, assign) BMKLocationAuthErrorCode permisionState;
  30. /**
  31. * @brief 得到BMKLocationAuth的单例
  32. */
  33. + (BMKLocationAuth*)sharedInstance;
  34. /**
  35. *@brief 启动引擎
  36. *@param key 申请的有效key
  37. *@param delegate 回调是否鉴权成功
  38. */
  39. -(void)checkPermisionWithKey:(NSString*)key authDelegate:(id<BMKLocationAuthDelegate>)delegate;
  40. @end
  41. #endif /* BMKLocationAuth_h */