“始终"与“始终"之间的区别和“在使用应用程序时"在iOS的位置服务中 [英] Difference between "Always" and "While Using App" in location services for iOS

查看:98
本文介绍了“始终"与“始终"之间的区别和“在使用应用程序时"在iOS的位置服务中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对定位服务的选择感到困惑.这三个选项分别是始终"和从不"以及在使用应用程序时".

I am flummoxed by the options in location services. The three options are "Always" and "Never" and "While Using the App".

最初,我以为在使用应用程序时"是指在前台使用该应用程序时.

Originally I thought "While Using the App" meant while using the app in the foreground.

始终"是指在前景或背景中使用它.

"Always" meant while using it in foreground or background.

但是此文档

某些应用程序仅在使用过程中才会要求使用您的位置.当您在应用程序中积极使用某个应用程序时,该应用程序被视为正在使用"前景,或在后台使用时,其状态栏将指示.

Some apps will ask to use your location only while the app is in use. An app is considered "in use" when you're actively using it in the foreground, or when it's in use in the background, which the status bar will indicate.

即使在应用程序运行时,其他应用程序也会要求您访问您的位置没有使用.当您允许某个应用始终使用您的位置信息时,iOS会提醒您应用后哪些应用可以使用您的位置信息在后台使用您的位置.

Other apps will ask for access to your location even when the app isn't in use. When you allow an app to always use your location, iOS will remind you which apps are able to use your location after an app uses your location in the background.

令人困惑.那么始终"与在使用应用程序时"有什么区别?

Confusing. So what is the difference between "Always" and "While Using the App?"

推荐答案

始终使用时之间的主要区别是:如果您使用的是后者,并且您的应用程序被杀死(无论是由用户还是由操作系统),那么您的应用程序将停止接收CoreLocation服务更新.只要您的应用程序在前台和后台,只要您启用了后台定位功能,您的应用程序都将收到更新.先前的权限将启动您的应用程序,即使该应用程序不在内存中.

The main difference between Always and When-in-use is: if you're using the latter and your app is killed (either by the user or the OS), then your app will stop receiving CoreLocation service updates. Your app will only receive updates as long as it is in the foreground, and in the background (given you enable background location capability). The former permission will launch your app even if it isn't in memory.

您可以在此开发人员文档页面上阅读更多的 .这是Apple开发人员文档的摘录:

You can read more on this developer documentation page. Here's an excerpt from Apple's developer documentation:

使用中授权.您的应用可以使用大多数服务,但不能使用自动重新启动应用的服务.您的应用在前台运行时必须始终启动服务.如果您为应用程序启用了后台定位功能,则已暂停的应用程序将在后台唤醒以处理位置事件.但是,如果您的应用未运行,则不会启动.

When-in-use authorization. Your app can use most services but cannot use services that automatically relaunch the app. Your app must always start services while running in the foreground. If you enable the background location capability for your app, a suspended app will wake in the background to handle location events. However, if your app is not running, it will not be launched.

始终授权..您的应用可以使用所有位置服务,并且可以从前台或后台启动这些服务.如果在您的应用未运行时发生了与位置相关的事件,则系统将启动您的应用并发送事件.

Always authorization. Your app can use all location services, and it can start those services from either the foreground or the background. If a location-related event occurs when your app is not running, the system launches your app and delivers the event.

这篇关于“始终"与“始终"之间的区别和“在使用应用程序时"在iOS的位置服务中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆