Recall & Review
beginner
What is a local notification in iOS?
A local notification is a message that an app schedules and delivers on the same device to alert the user, even if the app is not running in the foreground.
Click to reveal answer
beginner
Which iOS framework is used to manage local notifications?
The UserNotifications framework is used to schedule and manage local notifications in iOS.
Click to reveal answer
beginner
What permission must an app request to show local notifications?
The app must request authorization from the user to display alerts, play sounds, or badge the app icon using UNUserNotificationCenter's requestAuthorization method.
Click to reveal answer
intermediate
How do you schedule a local notification to trigger after 5 seconds?
Create a UNTimeIntervalNotificationTrigger with a time interval of 5 seconds and set repeats to false, then add a UNNotificationRequest with this trigger to UNUserNotificationCenter.
Click to reveal answer
intermediate
What is the role of UNNotificationRequest in local notifications?
UNNotificationRequest represents the notification to be delivered. It includes an identifier, content (title, body, sound), and a trigger that defines when to deliver the notification.
Click to reveal answer
Which class do you use to request permission for local notifications in iOS?
✗ Incorrect
UNUserNotificationCenter handles notification permissions and scheduling.
What does UNTimeIntervalNotificationTrigger do?
✗ Incorrect
UNTimeIntervalNotificationTrigger schedules a notification after a specified number of seconds.
Which method schedules a local notification?
✗ Incorrect
add(_:withCompletionHandler:) adds a notification request to the notification center.
What must you include in UNNotificationContent?
✗ Incorrect
UNNotificationContent includes title, body, sound, and other info to display in the notification.
Can local notifications be delivered if the app is closed?
✗ Incorrect
Local notifications are delivered by the system regardless of app state.
Explain the steps to schedule a local notification in iOS.
Think about what you need before showing a notification and how to tell the system when to show it.
You got /5 concepts.
Describe how you handle user permission for local notifications and why it is important.
Consider privacy and user control over notifications.
You got /4 concepts.