1
我的应用程序使用位置管理器。在updateService停止后,我看到上面的错误,并将委托设置为nil。下面的代码:EXC_BAD_ACCESS基于位置的应用程序
- (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-
你为什么要'self.myLocMgr'? –
当用户设置应用程序触发器时,我正在实例化它。但是,除了在viewDidLoad()方法中实例化之外,我删除了删除locMgr的语句。错误消失了。谢谢。 – Sam
@ DanielA.White您应该将其作为答案张贴,Sam应该接受它。只有公平的权利? –