且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS后台应用程序网络访问

更新时间:2023-01-01 16:59:49

根据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框架定期提供更新。

  • audio—The app plays audible content to the user while in the background. (This content includes streaming audio or video content using AirPlay.)
  • location—The app keeps users informed of their location, even while it is running in the background.
  • voip—The app provides the ability for the user to make phone calls using an Internet connection.
  • newsstand-content—The app is a Newsstand app that downloads and processes magazine or newspaper content in the background.
  • external-accessory—The app works with a hardware accessory that needs to deliver updates on a regular schedule through the External Accessory framework.
  • bluetooth-central—The app works with a Bluetooth accessory that needs to deliver updates on a regular schedule through the CoreBluetooth framework.

除了这项服务,你可以在后台中创建一个实际给你的有限长度任务结束网络的可能性k进程。

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.


如果您的应用正在执行一些重要任务,例如将用户数据写入磁盘或b $ b,这可能很重要从网络服务器下载一个重要的文件

This can be important if your app is performing some important task, such as writing user data to disk or downloading an important file from a network server.

关于你的问题,你能否做到并不是很清楚如果您在后台运行位置服务,请进行快速网络连接。我会说YES是短暂的连接,但不完全确定。自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.