【Multitasking】Executing a Finite-Length Task in the Background
来源:互联网 发布:淘宝联名卡怎么申请 编辑:程序博客网 时间:2024/06/05 18:55
//Starting a background task at quit time- (void)applicationDidEnterBackground:(UIApplication *)application { bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ // Clean up any unfinished task business by marking where you // stopped or ending the task outright. [application endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid;}]; // Start the long-running task and return immediately. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // Do the work associated with the task, preferably in chunks.<span style="font-family: Arial, Helvetica, sans-serif;">//如果要提前结束:</span><span style="color: rgb(68, 68, 68); font-family: Menlo; font-size: 10pt;">application</span><span style="color: rgb(68, 68, 68); font-size: 10pt; font-family: Menlo;">.backgroundTimeRemaining </span>
[application endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; });}
0 0
- 【Multitasking】Executing a Finite-Length Task in the Background
- Completing a Long-Running Task in the Background(在后台完成长时间运行的任务)
- DEBUG in background task
- c# task run in background
- Background Execution and Multitasking
- Loading Resources In The Background With A Loading Screen
- Presenting a local notification immediately while running in the background
- Working in the Background
- Running in a Background Service 之Sending Work Requests to the Background Service
- The Proccess of Loading and Executing a Specific Program in Linux Kernel
- Hide a process in the kill task menu
- Executing the Menu Commands in Excel
- 10 tips for time management in a multitasking world
- Are iOS 4 background API really the best solution to multitasking?
- Loading Data in the Background 之Running a Query with a CursorLoader
- the finite element method
- The finite state machine
- Running in a Background Service 之Creating a Background Service
- Android开发之旅一重启app程序
- eclipse 使用PMD预先检测错误
- 插入排序
- iOS 之适配iOS 8备忘录1
- 代码面试题:Delete duplicated char in string
- 【Multitasking】Executing a Finite-Length Task in the Background
- NFC模组,开发NFC功能 只要几条指令的事情
- 详细剖析Struts工作流程
- 控件安装和卸载(vc)
- 多节点的ntp 时间同步方法
- yarn
- 为什么要使用SLF4J而不是Log4J
- 程序员一周花多少时间编程?
- POJ 2886 Who Gets the Most Candies?