How to differentiate between CLCircularRegion and CLBeaconRegion invoking didEnterRegion

喜夏-厌秋 提交于 2019-12-25 03:51:53

问题


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!!!");
}

will be invoked. Can anybody tell me how to find out which region(i.e.,CLCircularRegion/CLBeaconRegion) is calling the delegate.


回答1:


Finally found my own answer.

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
if (region.class == CLCircularRegion.class) {
        NSLog(@"CLCircularRegion")
    } else {
        NSLog("CLBeaconRegion")
  }

}


来源:https://stackoverflow.com/questions/33500467/how-to-differentiate-between-clcircularregion-and-clbeaconregion-invoking-dident

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!