Discussion - Notifications in iOS 10

Brief breakdown of WWDC sessions related to notifications

What’s New in the Apple Push Notification Service Introduction to Notifications Advanced Notifications

New stuff

APNS Token-based authentication UserNotifications (and UserNotificationsUI) Framework (Unifies Remote and Local Notifications) Access to user-defined notification settings Expanded content

Titles Subtitles Media attachments

Scheduling and handling within Extensions In-app presentation Removal/update of pending notifications Dismissal actions Service Extensions

APNS Token-based authentication

Uses JSON Web Tokens (libraries widely available to assist with token generation) For server-side solutions where using a certificate isn’t practical/feasible Addresses issue of certificate expiration (though tokens also expire, new ones can be generated on the fly)

UserNotifications Framework

Provides a single notifications API across iOS, watchOS and tvOS

iOS: Full support for scheduling and management of notifications watchOS: Support for forwarded notifications and local notifications on the watch tvOS: Support for badging app icons

Key components/concepts:

UNUserNotificationCenter

Authorization requests Scheduling via requests (by providing content and triggers)

UNNotificationRequest

Identifier Content Trigger

UNMutableNotificationContent UNNotificationAttachment

Audio Images Video

Triggers

Push (UNPushNotificationTrigger is not instantiated by apps) UNTimeIntervalNotificationTrigger UNCalendarNotificationTrigger UNLocationNotificationTrigger

UNUserNotificationCenterDelegate Protocol

userNotificationCenter:willPresentNotification:withCompletionHandler: userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler

UNNotificationCategory - defines a type of notification, allows actionable notifications and content extensions UNNotificationAction - represents a task you can perform in response to a notification UNNotificationServiceExtension - Entry point for service extensions. Allows you to process the payload of a push notification before it is presented (eg: end-to-end encryption or notification attachments). Use in conjunction with “mutable-content: 1” in the aps portion of an APNS payload.

UserNotificationsUI Framework

Provides the UNNotificationContentExtension protocol View controllers adopt this protocol, using the VC’s view to display the notification contents Custom content is sandwiched between a header with the application icon and title and the default notification payload (default payload can be hidden using an attribute in the Info.plist) No user interaction Actions are displayed and extensions can respond to them by intercepting action responses Protocol provides a didRecieveNotification: method you can use to set up UI in response to the notification

Picks

Darryl

New Swift, Core Data and Cocoa Books - Use Your Loaf

John

List of Public Slack Groups Mr Robot returns to USA Network July 13