Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When the screen is locked, your app becomes inactive. Per <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html" rel="nofollow noreferrer">"Responding to Interruptions"</a> in iOS App Programming Guide:</p> <blockquote> <p>Pressing the Sleep/Wake button is another type of interruption that causes your app to be deactivated temporarily. When the user presses this button, the system disables touch events, <strong>moves the app to the background</strong> but sets the value of the app’s applicationState property to <code>UIApplicationStateInactive</code> (as opposed to <code>UIApplicationStateBackground</code>), and finally locks the screen.</p> </blockquote> <p>You can get extra time for background tasks according to <a href="http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW28" rel="nofollow noreferrer">"Executing a Finite-Length Task in the Background"</a> in the same guide:</p> <blockquote> <p>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 <a href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/beginBackgroundTaskWithExpirationHandler:" rel="nofollow noreferrer"><code>beginBackgroundTaskWithExpirationHandler:</code></a> method of the <code>UIApplication</code> class. If your app moves to the background while the task is in progress, or if your app was already in the background, this method <strong>delays the suspension of your app</strong>. This can be important if your app is performing some important task, such as writing user data to disk or <strong>downloading an important file from a network server</strong>. </p> </blockquote> <p>You can refer to the document to implement a finite-length download task in the background.</p> <p>Other references:</p> <ul> <li><a href="https://stackoverflow.com/q/4704037/1241690">Download data in background with iOS4</a></li> <li><a href="https://stackoverflow.com/q/4579810/1241690">iOS Application Background Downloading</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload