本文介绍了如何通过调用didEnterRegion区分CLCircularRegion和CLBeaconRegion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序使用地理围栏以及 iBeacon
监视。我设置了一些 CLCircularRegion
以及 CLBeaconRegion
进行监视。因此,每当我命中新信标或新位置时,
My app uses geofencing as well as iBeacon
monitoring. I have set up some CLCircularRegion
as well as CLBeaconRegion
to be monitor. So whenever, i hit a new beacon or new location, then
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"CLCircularRegion or CLBeaconRegion?, I am confused!!!");
}
将被调用。谁能告诉我如何找出哪个区域(即CLCircularRegion / CLBeaconRegion)正在调用该委托。
will be invoked. Can anybody tell me how to find out which region(i.e.,CLCircularRegion/CLBeaconRegion) is calling the delegate.
推荐答案
终于找到了自己的答案。
Finally found my own answer.
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
if (region.class == CLCircularRegion.class) {
NSLog(@"CLCircularRegion")
} else {
NSLog("CLBeaconRegion")
}
}
这篇关于如何通过调用didEnterRegion区分CLCircularRegion和CLBeaconRegion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!