在xcode中可以监控的最大区域是20个区域,我如何通过只监控最近的区域来监控超过这个数字的区域?
for (int i = 0; i < [AllRegionsArray count]; i++) {
NSArray *LongLati = [AllRegionsArray objectAtIndex:i];
lutiuid = [LongLati objectAtIndex:0];
Longtuid = [LongLati objectAtIndex:1];
CLLocationCoordinate2D centreLoc = {[lutiuid floatValue], [Longtuid floatValue]};
CLLocationDistance regionRadius = 100.00;
CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:centreLoc radius:regionRadius identifier:[NSString stringWithFormat:@"grRegion%i",i]];
[locationManager startMonitoringForRegion:grRegion desiredAccuracy:acc];
}发布于 2013-08-30 16:40:59
通过以下方式检查可用区域数:
[CLLocationManager regionMonitoringAvailable] 在位置感知编程指南中,
在指定要监视的区域集时,应始终谨慎。区域是共享的系统资源,系统范围内可用的区域总数是有限的。因此,核心位置限制了单个应用程序可以同时监视的区域数量。
因此,区域的最大数量是有限的,而不是固定的。它是在系统范围内共享的。关于你的问题,你应该重新定义你的地区。
记住要实现
locationManager:monitoringDidFailForRegion:withError:添加监控区域失败。
https://stackoverflow.com/questions/18527829
复制相似问题