【发布时间】:2011-04-29 00:00:30
【问题描述】:
在我的应用程序运行时,使用苹果 CLLocationManager 的位置更新工作正常。我决定实现苹果文档中描述的 MonitorSignificantLocationChanges 方法。
这是我的 applicationDidEnterBackground 方法:
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Switch to significant location change events monitoring
[self.viewController.locationController.locationManager stopUpdatingLocation];
[self.viewController.locationController.locationManager startMonitoringSignificantLocationChanges];
我遇到的问题是,无论我是否 startMonitoringSignificantLocationChanges,即使应用程序已从多任务栏中删除,我的应用程序仍会向 iOS 报告它正在使用位置更新。只需安装应用程序而无需运行它就足以让 iOS 在屏幕右上角显示位置图标,并且手机开始耗尽电池电量。我不知道如何在按下主页按钮时正确停止位置更新以及如何正确启动重大变化监控服务。
如果我可以提供任何其他有用的详细信息,请告诉我。
【问题讨论】:
标签: iphone ios gps core-location multitasking