Local Notifications

A local notification is an alert to the user that can appear even if your app is not running. In one of its manifestations, 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 as a dialog while your app is frontmost, your app would become inactive; see Chapter 11 and the applicationWillResignActive: app delegate message.)

Note

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 notification on your behalf.

The user has several choices as to how a notification from your app should be presented. These choices appear in the Settings app, under Notifications. There is a Notification Center, which appears when the user swipes downward from the very top of the screen, and the user can enable or disable your app’s notifications appearing there. A notification from your app can also appear as an alert, as a temporary banner at the top of the screen, or not at all. The ...

Get Programming iOS 6, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.