TencentLBSGeofenceRegion Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | NSCopying NSSecureCoding |
| Declared in | TencentLBSGeofenceRegion.h |
Overview
地理围栏区域基类,封装围栏的公共属性。 不应直接实例化,请使用子类 TencentLBSGeofenceCircleRegion 或 TencentLBSGeofencePolygonRegion。
identifier
围栏的唯一标识符,由调用方在创建时指定
@property (nonatomic, copy, readonly) NSString *identifierDeclared In
TencentLBSGeofenceRegion.h
userInfo
围栏的自定义附加信息,可用于传递业务数据
@property (nonatomic, copy, nullable) NSDictionary<NSString*id<NSSecureCoding> > *userInfoDeclared In
TencentLBSGeofenceRegion.h
center
围栏的中心坐标
@property (nonatomic, assign, readonly) CLLocationCoordinate2D centerDeclared In
TencentLBSGeofenceRegion.h
status
围栏当前的状态
@property (nonatomic, assign, readonly) TencentLBSGeofenceRegionStatus statusDeclared In
TencentLBSGeofenceRegion.h
regionType
围栏类型
@property (nonatomic, assign, readonly) TencentLBSGeofenceRegionType regionTypeDeclared In
TencentLBSGeofenceRegion.h
currentActiveAction
围栏当前触发的行为
@property (nonatomic, assign, readonly) TencentLBSGeofenceActiveAction currentActiveActionDeclared In
TencentLBSGeofenceRegion.h
activeAction
该围栏需要触发的行为,默认为 TencentLBSGeofenceActiveActionEnter。 可通过位运算组合多种行为,例如同时监听进入和离开: @code region.activeAction = TencentLBSGeofenceActiveActionEnter | TencentLBSGeofenceActiveActionExit; @endcode
@property (nonatomic, assign) TencentLBSGeofenceActiveAction activeActionDiscussion
该围栏需要触发的行为,默认为 TencentLBSGeofenceActiveActionEnter。 可通过位运算组合多种行为,例如同时监听进入和离开: @code region.activeAction = TencentLBSGeofenceActiveActionEnter | TencentLBSGeofenceActiveActionExit; @endcode
Note: 需要在添加围栏之前设置,否则围栏行为可能不符合预期
Declared In
TencentLBSGeofenceRegion.h
stayedDuration
停留事件的触发时间阈值,默认为 600 秒(10 分钟)。 当 activeAction 包含 TencentLBSGeofenceActiveActionStayed 时,用户在该围栏内 持续停留超过此时间后会触发停留回调。
@property (nonatomic, assign) NSTimeInterval stayedDurationDiscussion
停留事件的触发时间阈值,默认为 600 秒(10 分钟)。 当 activeAction 包含 TencentLBSGeofenceActiveActionStayed 时,用户在该围栏内 持续停留超过此时间后会触发停留回调。
Note: 最小值为 60 秒,设置小于 60 秒时将自动修正为 60 秒
Declared In
TencentLBSGeofenceRegion.h
– containsCoordinate:
判断指定坐标是否在围栏区域内
- (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinateParameters
coordinate |
待判断的坐标 |
|---|
Return Value
在围栏内返回 YES,否则返回 NO
Discussion
判断指定坐标是否在围栏区域内
Declared In
TencentLBSGeofenceRegion.h
– distanceToBoundaryFromCoordinate:
计算指定坐标到围栏边界的距离。 如果坐标在围栏内部,返回到最近边界的距离(正值); 如果坐标在围栏外部,返回到最近边界的距离(正值)。
- (CLLocationDistance)distanceToBoundaryFromCoordinate:(CLLocationCoordinate2D)coordinateParameters
coordinate |
待计算的坐标 |
|---|
Return Value
坐标到围栏边界的距离,单位为米
Discussion
计算指定坐标到围栏边界的距离。 如果坐标在围栏内部,返回到最近边界的距离(正值); 如果坐标在围栏外部,返回到最近边界的距离(正值)。
Declared In
TencentLBSGeofenceRegion.h