如何监控xcode中的许多区域?

时间:2013-08-30 07:58:40

标签: xcode core-location cllocationmanager locationmanager regions

在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];


    }

1 个答案:

答案 0 :(得分:0)

通过以下方式检查可用的区域数量:

[CLLocationManager regionMonitoringAvailable] 

在位置感知编程指南中,

  

在指定区域集时,您应始终谨慎   监控。区域是共享系统资源和总数   系统范围内可用的区域有限。出于这个原因,核心   位置限制了可能同时的区域数量   由单个应用程序监控。

因此,区域的最大数量是有限的&amp;不固定。它在系统范围内共享。参考您的问题,您应该重新定义您的区域。

请记住实施

locationManager:monitoringDidFailForRegion:withError:

如果在添加要监控的区域时出现任何故障。