问题描述
我有一个需要位置跟踪的应用程序,我认为它完全适合其中一种允许的背景模型.但是,当位置发生重大变化时,我需要发布到网络服务.我已经看到在后台处理中禁止状态网络访问的文章,但我没有在 Apple 的文档中阅读.
I have an application that requires location tracking and I think it fits squarely within one of the allowable background models. However, I need to post to a network service when there are significant changes of location. I've seen write-ups that state network access is prohibited in background processing, but I didn't read that in Apple's docs.
有谁知道在后台进程中进行偶尔和非常快速的网络更新是否符合 kosher(根据 Apple 政策)?
Does anyone know if it's kosher (wrt Apple policies) to make occasional and very quick network updates in a background process?
推荐答案
好点,根据 Apple 文档,后台只允许以下用法,并且每个服务都应该注册:
Good point, according to the Apple documentation only the following usages are allowed in background and each service should be registered:
- audio - 应用在后台向用户播放可听内容.(此内容包括流式音频或视频内容使用 AirPlay.)
- 位置 - 即使在后台运行,该应用也会让用户了解他们的位置.
- voip - 该应用使用户能够使用互联网连接拨打电话.
- newsstand-content - 该应用是一种报亭应用,可在后台下载和处理杂志或报纸内容.
- external-accessory——该应用与需要通过外部定期提供更新的硬件配件配合使用附件框架.
- bluetooth-central - 该应用程序与蓝牙配件配合使用,该配件需要通过蓝牙定期发送更新CoreBluetooth 框架.
除此服务外,您还可以在后台创建一个有限长度任务,这实际上使您有可能结束网络进程.
Other than this services, you can create a Finite-Length Task in the Background that actually give you the possibility to end a network process.
如果您的应用正在执行一些重要任务,这可能很重要,例如将用户数据写入磁盘或下载重要文件来自网络服务器.
关于您的问题,如果您在后台运行定位服务,是否可以进行快速网络连接并不是很清楚.对于短暂的连接,我会说是,但并不完全确定.自 iOS 4.0 起,此用法被拒绝并在文档中明确说明,现在该部分已被删除.
Regarding your question, it's not really clear if you can or not can do a quick network connection if you've a location service running in background. I would say YES for a short connection, but not totally sure. Since iOS 4.0 this usage was denied and clear in documentation, now that part has been removed.
这篇关于iOS后台应用网络接入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!