Local and Remote (push) Notifications, not NSNotifications.
This is going to describe the newer UserNotifications framework introduced in iOS 10, instead of the older UIKit-based way of doing notifications.
UNNotificationContent provides read-only access to information shown to the user about a specific notification. For setting information (e.g. when preparing to send a local notification), you’d use the
Either kind of notification can be an actionable notification.
- Calendar triggers for a specific date: “Today at 7 pm”, or “every day at 8 am”.
- Time triggers in a set time from now: In 30 seconds, or every 30 seconds.
- Location1 triggers when the user either exits or enters a specific region. You can set to send the notification for both entry and exit.
- Push is used to detect whether the notification you received is a push notification or not.
Types of Notifications
Local Notifications are notifications generated entirely on the device. These would be things that appear when you enter or leave an area, at a certain time, etc.
The way to send a local notification is to create a
UNNotificationRequest, with an identifier, content, and a trigger, then ask the
add(_:withCompletionHandler:) the request.
Also called Push Notifications. Push notifications are sent from some external server to your app.
As of iOS 7, you can also send “silent” or “content-available” notifications. These notifications do not present an alert to the user and instead wake up your app so that you can do something in response to the notification (usually update your content cache so when the user next opens the app they already have up to date information). See this apple documentation.
This requires location permissions, but not always permissions. Apparently, this is due to the system handling the monitoring as opposed to the app. I’ve never tried this, though.