我在写一个使用GPS数据的iPhone应用程序。我的问题是,GPS永远不会停止更新位置(箭头停留在状态栏上),即使我杀死了实际进程。使其消失的唯一方法是卸载应用程序,或禁止它在系统设置中使用位置。GPS不会停止更新
这是我如何创建外景经理:
// Create the location manager if this object does not
// already have one.
if (nil == locationManager)
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = regionTracker;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
// Set a movement threshold for new events.
locationManager.distanceFilter = 1;
[locationManager startUpdatingLocation];
在我的应用程序的委托,我都在applicationWillTerminate运行这两行:和applicationDidEnterBackground:
[self.viewController.locationManager stopUpdatingLocation];
[self.viewController.locationManager setDelegate:nil];
我nil代表,因为我看到他们这样做的一些例子,但是真的需要它吗?
locationManager属性是否在这些应用程序委托方法中提供了非零值? – Till 2011-03-31 12:13:38
是的。我只是测试了发射断点,如果它是零,没有骰子。感谢更多的帮助! – Accatyyc 2011-03-31 12:17:55