ios - 在后台运行的 GPS 应用程序

标签 ios core-location cllocationmanager

我有一个使用位置服务的 IOS 应用程序。

我知道使用位置服务的应用程序可以在后台执行。

但是,我不希望我的应用程序在后台运行。如果用户没有在看它,它就不应该通电。

这会自然发生吗(即使用位置服务的应用需要一些特殊的东西才能继续在后台运行?)?

如果不是,我需要做什么来确保使用位置服务的应用程序在进入后台时暂停?如果是这样,什么?恢复应用程序需要做什么?

谢谢

最佳答案

没问题 - 什么都不做。当用户离开您的应用(切换到另一个应用或锁定屏幕)时,您的应用将被暂停。

但是,要绝对确保您没有在后台执行任何定位操作,请使用 applicationDidEnterBackgroundapplicationWillEnterForeground 通知(或相应的应用委托(delegate)方法)来停止并重新开始位置更新。

关于ios - 在后台运行的 GPS 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22367123/

相关文章:

ios - 未导入到 Objective C 的 Swift 变量

ios - UILocalNotification 不会在 didEnterRegion 中触发

ios - 使用 CoreLocation 重要位置监控和 CoreBluetooth 时的电池消耗

iphone - 等待准确的 didUpdateToLocation

javascript - iOS 上的 IFrame 高度问题(移动版 safari)

ios - 如何将选定的行数据传递给另一个 ViewController

ios - "Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash"

ios - 使用 CLLocationManager 监控所有可用的信标区域

ios - 需要显示显示两个 CLLocation 引脚的屏幕

ios - 将多个收件人添加到 MFMailcomposer torecepients : field - Xcode IOS