Ios didEnterRegion方法仅对最近的区域激发

Ios didEnterRegion方法仅对最近的区域激发,ios,iphone,objective-c,cllocationmanager,Ios,Iphone,Objective C,Cllocationmanager,我正在尝试在我的应用程序中使用iOS didEnterRegion方法。我有一个将用户传递到profileViewController的tableView。在profileViewController的viewDidLoad方法中,我有一组纬度和经度坐标存储为一个区域,然后开始监视该区域 这段代码可以工作,但didEnterRegion方法仅为加载的最后一个概要文件激发。例如,如果我查看配置文件A并开始监视配置文件A的区域,然后查看配置文件B,则只有在我输入配置文件B的区域时,didEnterR

我正在尝试在我的应用程序中使用iOS didEnterRegion方法。我有一个将用户传递到profileViewController的tableView。在profileViewController的viewDidLoad方法中,我有一组纬度和经度坐标存储为一个区域,然后开始监视该区域

这段代码可以工作,但didEnterRegion方法仅为加载的最后一个概要文件激发。例如,如果我查看配置文件A并开始监视配置文件A的区域,然后查看配置文件B,则只有在我输入配置文件B的区域时,didEnterRegion才会触发

有人知道会出什么问题吗?谢谢

以下是profileViewController的viewDidLoad方法中的代码:

NSString *latOne = placeLatitude;
NSString *lngOne = placeLongitude;
NSString *radiusOne = @"100";

CLLocationDegrees latTwo = [latOne doubleValue];
CLLocationDegrees lngTwo =[lngOne doubleValue];
CLLocationDistance radiusTwo = [radiusOne doubleValue];

CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(latTwo, lngTwo);
CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates 
radius:radiusTwo identifier:[NSString stringWithFormat:@"grRegion%i", 1]];

[locationManager startMonitoringForRegion:grRegion];
我的didEnterRegion也在profileViewController中

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region 
{
    //local notification code is in here
}

为您的位置管理器设置为委派的视图控制器将实现/响应didEnter/didExit,我建议您使用位置管理器的Singleton模式(或共享实例),并正确设置取消委派。带有多个位置管理器的多个视图控制器可能会导致问题