基于位置的应用程序中的EXC_BAD_ACCESS

时间:2011-09-02 01:09:52

标签: exc-bad-access cllocationmanager

我的应用使用了位置管理器。在updateService停止后,我看到上面的错误,并且委托设置为nil。这是代码:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
     NSLog(@"location latitude %f",  newLocation.coordinate.latitude);
     NSLog(@"location longitude %f", newLocation.coordinate.longitude);

     if (<app-specific-location-trigger) {
      if (ivSignificantChangesModeUsed) 
         [[self myLocMgr] stopMonitoringSignificantLocationChanges];
      else
         [[self myLocMgr] stopUpdatingLocation];     

     [[self myLocMgr] setDelegate:nil];
     self.myLocMgr = nil;
     [self.navigationController popToRootViewControllerAnimated:NO];
     }
     NSLog(@"leaving didUpdateToLocation: method");
}

以下是控制台上的内容:

![2011-09-01 17:27:31.245   Latitude: 37.754280
2011-09-01 17:27:31.245   Longitude: -122.197792
2011-09-01 17:27:32.051   leaving didUpdateToLocation: method

(gdb) continue
Program received signal:  “EXC_BAD_ACCESS”.
(gdb)][1]

以下是调试视图中显示的内容......

感谢所有帮助。

谢谢, -S -

1 个答案:

答案 0 :(得分:1)

你为什么要骂self.myLocMgr? (这是OP要求的)