You are developing an app, such as an alarm clock or a calendar app, that needs to inform the user of an event at a specific time, even if your app is not running or is in the background.
Instantiate an object of type
UILocalNotification, configure it (we will see
how), and schedule it using the
scheduleLocalNotification: instance method of
You can get the instance of your application object using the
sharedApplication class method of the
A local notification is what gets presented
to the user if your application is running in the background or not
running at all. You can schedule the delivery of a local notification
instance method of
your app is running in the foreground and a
scheduled local notification is fired, no alert is displayed to the
user. Instead, iOS will silently, through an app delegate message, let
you know that the notification was fired. Don’t worry about this for
now; we will go into details about all this quite soon.
You can ask iOS to deliver a local notification to the user in the future when your application is not even running. These notifications could also be recurring—for instance, every week at a certain time. However, extra care must be taken when you are specifying the fire date for your notifications.
cancelAllLocalNotifications instance method cancels the delivery of all pending local notifications ...