2012年3月9日

[iOS] 程式進入背景後之支援類型

iOS 4.0 之後允許以下型態的用途進入背景執行

1. audio
2. Voice over IP
3. Background location
4. Push notifications
5. Local notifications
6. Task finishing - If your app is in mid-task when your customer leaves it, the app can now keep running to finish the task.
7. Fast app switching - All developers should take advantage of fast app switching, which allows users to leave your app and come right back to where they were when they left - no more having to reload the app.

一般都用 Task finishing, 系統會分配時間給你執行, 如果超過分配的時間 (預設是 600 秒 也就是10 分鐘), 系統會自動結束 process, 可利用下列語法查看, 系統分配備背景執行時間是多少
NSLog(@"Background remain time %f : ", [application backgroundTimeRemaining]);

參考來源 : iOS App Programming Guide: App States and Multitasking

沒有留言: