应用程序终止后 CLLocationManager 仍处于活动状态

发布于 2024-11-15 04:45:32 字数 153 浏览 1 评论 0原文

我通过在 plist 文件中设置“必需的后台模式”标志来尝试在后台运行 CLLocationManager,它确实有效,问题是在我终止应用程序(在任务管理器中关闭它)后,位置图标(状态栏上的三角形)仍然显示向上。删除应用程序后,位置图标消失。我想知道的是我是否需要对这种背景位置进行特殊清理?

I experimented CLLocationManager that run in background by setting "Required background modes" flag in plist file and it does work, the problem is after I terminated the app (close it in task manager) the location icon (triangle on the status bar) still showing up. After I delete the app the location icon disappear. What I want to know is do I need special clean up for this kind of background location ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍风燃霜 2024-11-22 04:45:32

三角形并不意味着 cllocationmanager 处于活动状态。它仅显示应用程序请求了您设备的位置服务,并且如果应用程序想要访问,则位置服务处于开启状态(可访问)。这并不意味着 GPS 仍然开启。如果您的应用程序已关闭,但电池电量很快耗尽,只有这样才意味着 GPS 处于活动状态。即使如此,您也不必担心,因为其他一些应用程序可能正在使用 GPS。

删除应用程序后它就会消失,因为操作系统保留了过去 24 小时内请求位置服务的应用程序的记录,如果找到这样的应用程序,则会显示紫色三角形。当您删除应用程序时,操作系统找不到记录,因此三角形消失。

The triangle doesnt mean that cllocationmanager is active. It only shows that your device's location services were requested by an app and that location services are ON (accessible) if an app wants to access. It doesnt mean that gps is still on. If your app is closed but the the battery is getting drained pretty quick, only then it means that gps is active. Even then you dont need to worry about it because some other app may be using gps.

It goes away after deleting the app because the os maintains a record of apps that requested location services within last 24 hrs and if it finds such an app then it displays the purple triangle. When you delete the app, the os cant find a record and hence the triangle goes away.

×纯※雪 2024-11-22 04:45:32

后来发现是iphone的问题。在“设置”中重置位置警告后,一切都按我的预期进行。

It turn out that it was a problem on iphone. After reset location warning in Settings everything work as I expected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文