EXC_BAD_ACCESS in location based app
My app uses Location Manager. I see the above error after the updateService is stopped, and the delegate is set to nil. Here's the code:
- (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 my开发者_运维技巧LocMgr] stopMonitoringSignificantLocationChanges];
else
[[self myLocMgr] stopUpdatingLocation];
[[self myLocMgr] setDelegate:nil];
self.myLocMgr = nil;
[self.navigationController popToRootViewControllerAnimated:NO];
}
NSLog(@"leaving didUpdateToLocation: method");
}
Here is what is on the console:
![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]
Here's what's shown in the debug view...
All help is appreciated.
Thanks, -S-
why are you niling self.myLocMgr
? (This is requested by the OP)
精彩评论