Push Notifications Flashcards
Notification message flow

Maximum payload
4KB
grouping notification
Adding the thread_identifier key to the alert dictionary will let iOS combine all notifications with the same identifier value into a single group in the notification center
“Utilize the apns-collapse-id HTTP header field when”
“overriding” or “updating” your notification is more appropriate than sending an additional notification.”
Standard Payload
aps”: {
“alert”: {
“title”: “Your food is done.”,
“body”: “Be careful, it’s really hot!”
},
“badge”: 12,
“sound”: {
“critial”: 1,
“name”: “filename.caf”,
“volume”: 0.75
}
}
}
everything what outside is your custom keys
When apple will issue a new device token
When the user installs the app on another device, restores from an old backup, reinstalls iOS and in some other cases. You should never try and link a token to a specific user.
Provisional authorization
“Apple provides another useful case for the UNAuthorizationOptions enum that you can pass to requestAuthorization during setup. If you include .provisional in the options argument, notifications will automatically be delivered silently to the user’s Notification Center, without asking for permission - there will be no sound or alerts for these provisional notifications.”
Critical alerts
Critical alerts will bypass the Do Not Disturb and ringer switch settings as well as always play a sound… even a custom sound.
“If you’d like to have iOS display your notification while your app is running in the foreground, you’ll need to implement the UNUserNotificationCenterDelegate method:
which is called when a notification is delivered to your app while it’s in the foreground. The only requirement of this method is calling the completion handler before it returns
tap notification
didRecieve
Make another class delegate for nsNotificationDelegate
you can send info from appDelegate, but appDelegate is a delegate for NSNotification and it the same time you can make another class to conform NSNotificationDelegate and set it as self in appDelegate for NSNotification object

For iOS to display your notification while your app is running in the foreground, you’ll need to implement a
UNUserNotificationCenterDelegate method, which is called when a notification is delivered to your app while it’s in the foreground.”
Sometimes, you want a tapped notification to open a specific view controller within your app. You will need to
add an additional method to handle this routing.
You can make a push notification actionable by attaching
a button to a notification
Notification categories allow you to specify
up to four custom actions per category that will be displayed with your push notification
Since you do not want the AppDelegate to be where you take action when a push notification arrives
send a Foundation notification that reports what happened instead. That allows your other view controllers to take an appropriate action.
How to send info that User click action to other view controller
- create & register category
- create Notification.Name ext to send appropriate notification for each action
- subscribe from each vc that you want to get it

Sharing data with your main target
App Groups
badging push notification
use userDefault to calculate badges
Get info from core date from service ext
Checkmark service ext in each class that you going to use in service ext (app groups should be enabled)
Create custom place for your core date container

Accepting text input in push notification
UNTextInputNotificationAction
