使用Core Location在后台执行适当的功能吗? [英] Is using Core Location for performing functionality in the background appropriate?
问题描述
最近,我注意到有一些应用程序请求访问用户的位置以在后台执行某些功能。
Lately, I've notice that there are a few applications request to access the user's location for performing some functionalities in the background.
例如:用于扫描和上传用户照片以进行备份的应用程序,因此当进入后台状态时,它会继续扫描和上传。
For example: Application for scanning and uploading the user's photos for backup purposes, so when entering the background state, it keeps scanning and uploading.
我是什么询问:
-
如果有后台执行机制,用于执行后台任务(选择目标 - >功能 - >背景模式),那么为什么要使用核心位置来做这样的事情呢?
If there are Background Execution mechanisms for executing Background Tasks (Select Target -> Capabilities -> Background Modes), so why using the Core Location for doing such a thing?
如果使用核心位置不同,那么是什么使用它的好处?
If using Core Location is different, what is the benefit of using it?
另外,我读过(和我所假设的是,使用核心位置而不是意味着应该导致应用程序被拒绝,这是一个奇怪的事情 - 我提到过 - 有一些应用程序正在这样做!我觉得有点困惑。
Also, I've read (and this is what I assume) that using the core location for not what is meant should causes to let the application to be rejected, the weird thing that -as I mentioned- there are a few applications doing this! I feel a little confused about it.
推荐答案
另外,我读过(这是我所假设的是,使用核心位置而不是意味着什么应该导致应用程序被拒绝,奇怪的是 - 我提到过 - 有一些应用程序这样做!我对此感到有些困惑。
Also, I've read (and this is what I assume) that using the core location for not what is meant should causes to let the application to be rejected, the weird thing that -as I mentioned- there are a few applications doing this! I feel a little confused about it.
你有理由怀疑。 不模仿此行为。这些人滥用 CoreLocation是一种让他们的代码在后台运行的方法,即使他们并没有真正使用任何CoreLocation功能。
You are right to be in doubt. Do not imitate this behavior. These people are misusing CoreLocation as a way of getting their code to run in the background even though they are not really using any CoreLocation features.
你不能在后台随意做事 - 而且有充分的理由。不要违反规定。如果您想在后台继续上传,请使用带有后台URLSessionConfiguration的URLSession。以正确的方式做事。
You are not allowed to do things arbitrarily in the background — and with good reason. Don't violate the rules. If you want to keep uploading even when in the background, use a URLSession with a background URLSessionConfiguration. Do things the right way.
这篇关于使用Core Location在后台执行适当的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!