Simple Local Reminder
Goal
Request permission (if needed) and schedule a local notification after a time interval.
Actions used
NotificationServicesGetSettingsNotificationServicesRequestPermissionNotificationServicesGetRequestPermissionError(optional)NotificationServicesCreateBuilderNotificationServicesScheduleNotificationNotificationServicesGetScheduleNotificationError(optional)
Variables
permissionStatus(Enum:NotificationPermissionStatus) ←NotificationServicesGetSettings.statustitle(String)body(String)delaySeconds(Float)
Flow
State:
GetSettingsAction:
NotificationServicesGetSettings→status(store intopermissionStatus)Branch using an Enum Compare/Switch on
permissionStatus:Authorized / Provisional →
BuildNotificationNotDetermined →
RequestPermissionDenied → show “Enable notifications in Settings” and stop
State:
RequestPermissionAction:
NotificationServicesRequestPermission(choose your options, e.g., Alert/Badge/Sound)Events:
grantedEvent→BuildNotificationdeniedEvent→ show errorfailureEvent→GetRequestPermissionError(optional) then show error
State:
BuildNotificationAction:
NotificationServicesCreateBuilderExample inputs:
notificationId:"reminder_1"title:titlebody:bodytriggerType:TimeIntervaltimeInterval:delaySecondsrepeats:falsesoundFileName:"default"(optional)
State:
ScheduleAction:
NotificationServicesScheduleNotificationEvents:
successEvent→ donefailureEvent→GetScheduleNotificationError(optional) then show error
Notes
NotificationServicesCreateBuilderonly builds/caches the notification;NotificationServicesScheduleNotificationactually schedules it.If permission is denied, iOS won’t show the system prompt again; users must enable it from device Settings.
Last updated
Was this helpful?