如何使用CLLocationManager监视20个以上的区域

我有大约2000个区域我想要使用CLLocationManager监视(仅限入口),我有一个函数可以找到20个最近的存储( Store是一个inheritance自NSObject并且具有名为geoPointCLLocationCoordinate2D属性的geoPoint )到用户的当前位置但是在哪里我该叫它吗?

如果有人能用我的代码示例帮助我,那就太好了!

找到最近的20家商店func:

 -(void)sortClosestStores { [self.allStores sortUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { CLLocation *location1=[[CLLocation alloc] initWithLatitude:((Store*)obj1).geoPoint.latitude longitude:((Store*)obj1).geoPoint.longitude]; CLLocation *location2=[[CLLocation alloc] initWithLatitude:((Store*)obj2).geoPoint.latitude longitude:((Store*)obj2).geoPoint.longitude]; float dist1 =[location1 distanceFromLocation:self.locationManager.location]; float dist2 = [location2 distanceFromLocation:self.locationManager.location]; if (dist1 == dist2) { return NSOrderedSame; } else if (dist1 < dist2) { return NSOrderedAscending; } else { return NSOrderedDescending; } }]; if (self.twentyClosestStores==nil) { self.twentyClosestStores=[NSMutableArray array]; } if (self.previousTwentyStores==nil) { self.previousTwentyStores=[NSMutableArray array]; } self.previousTwentyStores=self.twentyClosestStores; self.twentyClosestStores=[NSMutableArray array]; for (int i = 0; i < 20; i++) { [self.twentyClosestStores addObject:[self.allStores objectAtIndex:i]]; } } 

提前致谢!