Acc*_*yyc 3 iphone objective-c ios4
我正在编写一个使用GPS数据的iPhone应用程序.我的问题是即使我杀了实际的过程,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];
Run Code Online (Sandbox Code Playgroud)
在我的app委托中,我在applicationWillTerminate:和applicationDidEnterBackground中运行这两行:
[self.viewController.locationManager stopUpdatingLocation];
[self.viewController.locationManager setDelegate:nil];
Run Code Online (Sandbox Code Playgroud)
我没有代表,因为我看到他们这样做的一些例子,但它真的需要吗?
| 归档时间: |
|
| 查看次数: |
3155 次 |
| 最近记录: |