BaiduLoc_IOSSDK_v2.0.9_Docs  2.0.9
BMKGeoFenceManager.h
浏览该文件的文档.
1 //
2 // BMKGeoFenceManager.h
3 // BMKLocationKit
4 //
5 // Created by baidu on 2017/3/2.
6 // Copyright © 2017年 baidu. All rights reserved.
7 //
8 
9 #import "BMKGeoFenceRegion.h"
10 #import "BMKLocation.h"
11 
13 
15 typedef NS_OPTIONS(NSUInteger, BMKGeoFenceActiveAction)
16 {
17  BMKGeoFenceActiveActionNone = 0,
18  BMKGeoFenceActiveActionInside = 1 << 0,
19  BMKGeoFenceActiveActionOutside = 1 << 1,
20  BMKGeoFenceActiveActionStayed = 1 << 2,
21 };
22 
24 FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKGeoFenceErrorDomain;
25 
27 typedef NS_ENUM(NSInteger, BMKGeoFenceErrorCode) {
28  BMKGeoFenceErrorUnknown = 1,
29  BMKGeoFenceErrorInvalidParameter = 2,
30  BMKGeoFenceErrorFailureConnection = 3,
31  BMKGeoFenceErrorFailureAuth = 4,
32  BMKGeoFenceErrorNoValidFence = 5,
33  BMKGeoFenceErroFailureLocating = 6,
34 };
35 
36 
38 @interface BMKGeoFenceManager : NSObject
39 
40 
42 @property (nonatomic, weak, nullable) id<BMKGeoFenceManagerDelegate> delegate;
43 
44 
46 @property (nonatomic, assign) BMKGeoFenceActiveAction activeAction;
47 
48 
50 @property(nonatomic, assign) CLLocationDistance distanceFilter;
51 
52 
54 @property(nonatomic, assign) CLLocationAccuracy desiredAccuracy;
55 
56 
58 @property(nonatomic, assign) CLActivityType activityType;
59 
60 
62 @property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
63 
64 
66 @property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
67 
68 
76 - (void)addCircleRegionForMonitoringWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID;
77 
78 
86 - (void)addPolygonRegionForMonitoringWithCoordinates:(CLLocationCoordinate2D * _Nonnull)coordinates count:(NSInteger)count coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID;
87 
88 
94 - (NSArray * _Nullable)geoFenceRegionsWithCustomID:(NSString * _Nullable)customID;
95 
96 
101 - (void)removeTheGeoFenceRegion:(BMKGeoFenceRegion * _Nonnull)region;
102 
103 
108 - (void)removeGeoFenceRegionsWithCustomID:(NSString * _Nullable)customID;
109 
110 
115 
116 
117 @end
118 
119 
120 
122 @protocol BMKGeoFenceManagerDelegate <NSObject>
123 
124 @optional
125 
132 - (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager;
133 
141 - (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didAddRegionForMonitoringFinished:(NSArray <BMKGeoFenceRegion *> * _Nullable)regions customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error;
142 
143 
151 - (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didGeoFencesStatusChangedForRegion:(BMKGeoFenceRegion * _Nullable)region customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error;
152 
159 - (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didUpdateLocation:(BMKLocation * _Nullable)location orError:(NSError * _Nullable)error;
160 
166 - (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didFailWithError:(NSError * _Nullable)error;
167 @end
168 
NS_ENUM
typedef NS_ENUM(NSInteger, BMKGeoFenceErrorCode)
地理围栏错误码
Definition: BMKGeoFenceManager.h:27
BMKGeoFenceManager
地理围栏管理类
Definition: BMKGeoFenceManager.h:39
BMKGeoFenceManager::desiredAccuracy
CLLocationAccuracy desiredAccuracy
设定定位精度。默认为 kCLLocationAccuracyBest。
Definition: BMKGeoFenceManager.h:54
BMKGeoFenceManager::delegate
id< BMKGeoFenceManagerDelegate > delegate
实现了 BMKGeoFenceManagerDelegate 协议的类指针。
Definition: BMKGeoFenceManager.h:42
BMKGeoFenceErrorDomain
FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKGeoFenceErrorDomain
BMKGeoFence errorDomain
Definition: BMKGeoFenceManager.h:21
BMKGeoFenceManager::allowsBackgroundLocationUpdates
BOOL allowsBackgroundLocationUpdates
是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
Definition: BMKGeoFenceManager.h:66
BMKGeoFenceRegion
地理围栏基类,不可直接使用
Definition: BMKGeoFenceRegion.h:26
BMKLocation.h
BMKGeoFenceManager::activeAction
BMKGeoFenceActiveAction activeAction
需要进行通知的行为,默认为BMKGeoFenceActiveActionInside。
Definition: BMKGeoFenceManager.h:46
BMKGeoFenceManager::pausesLocationUpdatesAutomatically
BOOL pausesLocationUpdatesAutomatically
指定定位是否会被系统自动暂停。默认为NO。
Definition: BMKGeoFenceManager.h:62
BMKGeoFenceManagerDelegate-p
地理围栏代理协议,该协议定义了获取地理围栏相关回调方法,包括添加、状态改变等。
Definition: BMKGeoFenceManager.h:122
BMKGeoFenceManager::distanceFilter
CLLocationDistance distanceFilter
设定定位的最小更新距离。默认为 kCLDistanceFilterNone。
Definition: BMKGeoFenceManager.h:50
BMKGeoFenceRegion.h
BMKGeoFenceManager::activityType
CLActivityType activityType
设定定位类型。默认为 CLActivityTypeAutomotiveNavigation。
Definition: BMKGeoFenceManager.h:58
NS_OPTIONS
typedef NS_OPTIONS(NSUInteger, BMKGeoFenceActiveAction)
地理围栏监听状态类型
Definition: BMKGeoFenceManager.h:15
BMKLocation
描述百度iOS 定位数据
Definition: BMKLocation.h:40
-[BMKGeoFenceManager removeAllGeoFenceRegions]
void removeAllGeoFenceRegions()
移除所有围栏