A local notification is an alert to the user that can appear even if your app is not running. In its most commonly used manifestation, it appears as a dialog on top of whatever the user is doing at that moment, which is why it is treated in this chapter. (If a local notification from some other app were to appear while your app is frontmost, your app would become inactive; see Chapter 11 and the
applicationWillResignActive: app delegate message.) Local notifications were introduced in iOS 4.
This use of the term notification has nothing to do with NSNotification (Chapter 11). The ambiguity is unfortunate.
Your app does not present a local notification alert: indeed, your app can’t present a local notification alert, because if your app’s local notification alert appears, your app ex hypothesi isn’t frontmost. Rather, your app hands a local notification to the system along with instructions about when the local notification should fire. When the specified time arrives, if your app isn’t frontmost, the system presents the alert on your behalf.
The alert can optionally contain an action button. (If the alert appears when the device is locked, this will appear as a slider.) If user taps this, your app will be brought to the front, launching it if it isn’t already suspended in the background.
To create a local notification, you configure a UILocalNotification object and hand it to the system with UIApplication’s
scheduleLocalNotification:. The UILocalNotification ...