IOS Parallel Tasks

Source: Internet
Author: User

Task parallelism is not supported prior to IOS 4.0

Determine if the current device supports task parallelism

Before the app is in the background state and before it is suspended, you can call UIApplication's Beginbackgroundtaskwithname:expirationhandler: method to delay the suspend to perform some important tasks, such as saving user data. Because the system is assigned a limited amount of time to perform background tasks for the app, it is called before the background task times out or the system forces the Kill app.endBackgroundTask:方法来结束掉后台任务。App 对象的 backgroundTimeRemaining 属性用来查询可用的剩余的执行时间。启动后台任务时,beginBackgroundTaskWithExpirationHandler: 的返回值是这个任务的唯一标识,把这个唯一标识传递给 endBackgroundTask: ,就可以终结掉这个任务。

Example:

Create a task in the background, and then hand this task to a dispatch queue for this task to be executed synchronously, where Bgtask is the member variable of the class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.