简体   繁体   中英

Set Variable when iOS app suspended

In my application I am using GCD global queue to perform some tasks. Normally my Application runs in background mode for 10 Minutes (GCD working fine and also the @perfomselector). After that nothing is running.

My questions are,

  • Is that apple always allow a application to execute code in the background mode for 10 Minutes?

  • Is (always) application suspended after this 10 minutes?

  • Is that any possible way to set a variable when application is being suspended?(I some where studied application will not notify when its being suspended)

  • Is there any way to check the status of GCD (suspended or not) .

Is that apple always allow a application to execute code in the background mode for 10 Minutes?

-> Apps that are transitioning to the background can request an extra amount of time to finish any important last-minute tasks. To request background execution time, call the beginBackgroundTaskWithName:expirationHandler: method of the UIApplication class. Use the backgroundTimeRemaining property of the app object to see how much time is available.

Is (always) application suspended after this 10 minutes?

-> I think there is not having a limitation like 10 minutes. The device only give a limited amount of time for performing tasks in background.

Is that any possible way to set a variable when application is being suspended?(I some where studied application will not notify when its being suspended)

-> No.When the app is in the background but is not executing code. The system moves apps to the suspended state automatically and does not notify them before doing so. backgroundTimeRemaining property might be helpful for getting the remaining time to perform some bg tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM