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?
AUNUserNotificationCenter
BUIApplication
CUNNotificationRequest
DUNNotificationContent
✗ Incorrect
UNUserNotificationCenter handles notification permissions and scheduling.
What does UNTimeIntervalNotificationTrigger do?
ACancels a notification
BTriggers a notification at a calendar date
CRequests notification permission
DTriggers a notification after a time interval
✗ Incorrect
UNTimeIntervalNotificationTrigger schedules a notification after a specified number of seconds.
To trigger at a specific time daily, use UNCalendarNotificationTrigger with repeats true and matching hour and minute.
Step 2: Compare options
UNTimeIntervalNotificationTrigger(timeInterval: 86400, repeats: true) repeats every 86400 seconds but may drift; UNCalendarNotificationTrigger(dateMatching: DateComponents(hour: 8, minute: 0), repeats: true) correctly uses calendar components for 8:00 AM daily; UNCalendarNotificationTrigger(dateMatching: DateComponents(hour: 8, minute: 0), repeats: false) does not repeat; UNTimeIntervalNotificationTrigger(timeInterval: 3600, repeats: true) repeats every hour, not daily.
Final Answer:
UNCalendarNotificationTrigger(dateMatching: DateComponents(hour: 8, minute: 0), repeats: true) -> Option D
Quick Check:
Use calendar trigger with repeats true for daily time [OK]
Hint: Use calendar trigger with repeats true for daily notifications [OK]
Common Mistakes:
Using time interval triggers for exact daily time
Setting repeats false for repeating notifications
Confusing seconds with hours in timeInterval
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.