当应用程序处于后台时运行 CLLocation

发布于 2024-10-14 22:47:05 字数 75 浏览 3 评论 0原文

如何让 CLLocation 在后台保持更新。我相信您需要注册应用程序才能在应用程序委托中执行此操作,但我在任何地方都找不到对此的引用?

How is it possible to keep CLLocation updating in the background. I believe you need to register the application to do this in the Application delegate but I can not find a reference to this anywhere?

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

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

发布评论

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

评论(1

很快妥协 2024-10-21 22:47:05

以下是相关文档的链接:

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072- CH4-SW20

特别是

,请参阅本段:应用程序可以声明自己需要连续的后台位置更新。需要在前台和后台定期更新位置的应用程序应将 UIBackgroundModes 键添加到其 Info.plist 文件中,并将该键的值设置为包含 location< /代码> 字符串。此选项适用于提供特定服务(例如导航服务)的应用程序,这些服务涉及让用户始终了解其位置。应用程序的 Info.plist 文件中存在密钥告诉系统它应该允许应用程序根据需要在后台运行

Here is a link to the relevant documentation:

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20

in particular, see this paragraph:

An application can declare itself as needing continuous background location updates. An application that needs regular location updates, both in the foreground and background, should add the UIBackgroundModes key to its Info.plist file and set the value of this key to an array containing the location string. This option is intended for applications that provide specific services, such as navigation services, that involve keeping the user informed of his or her location at all times. The presence of the key in the application’s Info.plist file tells the system that it should allow the application to run as needed in the background

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