Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 是否未调用地理围栏didEnterRegion和didExitRegion方法?_Objective C_Ios7_Xcode5_Geofencing - Fatal编程技术网

Objective c 是否未调用地理围栏didEnterRegion和didExitRegion方法?

Objective c 是否未调用地理围栏didEnterRegion和didExitRegion方法?,objective-c,ios7,xcode5,geofencing,Objective C,Ios7,Xcode5,Geofencing,嗨,伙计们,我在做地理围栏!Location manager DidDetermingEstate正在正确调用,但当我输入region时,从未调用过didEnterRegion和didExitRegion 这是我的密码 **ViewController.m** GeofenceMonitor * gfm = [GeofenceMonitor sharedObj]; NSMutableDictionary * fence1 = [NSMutableDictionary new]; [fe

嗨,伙计们,我在做地理围栏!Location manager DidDetermingEstate正在正确调用,但当我输入region时,从未调用过didEnterRegion和didExitRegion

这是我的密码

   **ViewController.m**

GeofenceMonitor  * gfm = [GeofenceMonitor sharedObj];
NSMutableDictionary * fence1 = [NSMutableDictionary new];
[fence1 setValue:@"office" forKey:@"identifier"];
[fence1 setValue:@"13.04765701" forKey:@"latitude"];
[fence1 setValue:@"80.18752289" forKey:@"longitude"];
[fence1 setValue:@"100" forKey:@"radius"];
[fence1 setValue:@"11" forKey:@"id"];

NSMutableDictionary * fence2 = [NSMutableDictionary new];
[fence2 setValue:@"axis baank end" forKey:@"identifier"];
[fence2 setValue:@"13.04705048" forKey:@"latitude"];
[fence2 setValue:@"80.18778229" forKey:@"longitude"];
[fence2 setValue:@"100" forKey:@"radius"];
[fence2 setValue:@"12" forKey:@"id"];


if([gfm checkLocationManager])
{
    [gfm addGeofence:fence1];
    [gfm addGeofence:fence2];
    [gfm findCurrentFence];
}
GeofenceMonitor.m


请尝试调用主线程

if ([CLLocationManager locationServicesEnabled])
    {
        [self performSelectorOnMainThread:@selector(updateLocation) withObject:self waitUntilDone:NO];
    }


- (void)updateLocation
{
     arr_region=[[NSMutableArray alloc] init];
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
     self.locationManager.pausesLocationUpdatesAutomatically = NO;
    [locationManager startUpdatingLocation];
}

我希望它能有所帮助。

+20我一直在寻找同样的东西。
if ([CLLocationManager locationServicesEnabled])
    {
        [self performSelectorOnMainThread:@selector(updateLocation) withObject:self waitUntilDone:NO];
    }


- (void)updateLocation
{
     arr_region=[[NSMutableArray alloc] init];
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
     self.locationManager.pausesLocationUpdatesAutomatically = NO;
    [locationManager startUpdatingLocation];
}