View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vidéos

Ouvrir le menu Fermer le menu
  • Collections
  • Toutes les vidéos
  • À propos

Plus de vidéos

  • À propos
  • Code
  • Send communication and Time Sensitive notifications

    Learn more about the evolution of notifications on Apple platforms. We'll explore how you can help people manage notifications within your app, including how you can craft meaningful moments with interruption levels and Time Sensitive notifications. And we'll introduce you to communication notifications, providing a richer experience for calls and messages in your app through SiriKit.

    To get the most out of this session, we recommend having experience creating local and remote notifications, as well as some familiarity with SiriKit intents.

    Ressources

    • INStartCallIntent
    • INSendMessageIntent
    • User Notifications
    • SiriKit
      • Vidéo HD
      • Vidéo SD

    Vidéos connexes

    WWDC21

    • Donate intents and expand your app’s presence
  • Rechercher dans cette vidéo…
    • 1:57 - Notification Action Icons

      // Setting up notification actions with icons
      
      let likeActionIcon = UNNotificationActionIcon(systemImageName: "hand.thumbsup")
      let likeAction = UNNotificationAction(identifier: "like-action",
                                                 title: "Like",
                                               options: [],
                                                  icon: likeActionIcon)
              
      let commentActionIcon = UNNotificationActionIcon(templateImageName: "text.bubble")
      let commentAction = UNTextInputNotificationAction(identifier: "comment-action",
                                                             title: "Comment",
                                                           options: [],
                                                              icon: commentActionIcon,
                                              textInputButtonTitle: "Post",
                                              textInputPlaceholder: "Type here…")
      
      let category = UNNotificationCategory(identifier: "update-actions",
                                               actions: [likeAction, commentAction],
                                     intentIdentifiers: [], options: [])
    • 8:19 - Notification Interruption Levels

      // Interruption levels
      
      let enum UNNotificationInterruptionLevel : Int {
          case passive = 0
          case active = 1
          case timeSensitive = 2
          case critical = 3
          public static var `default`: UNNotificationInterruptionLevel { get }
      }
    • 8:31 - Passive Notification: Local

      // Interruption levels
      // Local notification
      
      import UserNotifications
      
      let content = UNMutableNotificationContent()
      content.title = "Passive"
      content.body = "I’m a passive notification, so I won’t interrupt you."
      content.interruptionLevel = .passive
      
      let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
      
      let request = UNNotificationRequest(identifier: "passive-request-example",
                                             content: content,
                                             trigger: trigger)
    • 8:47 - Passive Notification: Push

      // Interruption levels
      // Push notification
      
      {
          "aps" : {
              "alert" : {
                  "title" : "Passive",
                  "body" : "I’m a passive notification, so I won’t interrupt you."
              }
              "interruption-level" : "passive"
          }
      }
    • 11:13 - Time Sensitive Notification: Local

      // Time Sensitive
      // Local notification
      
      let content = UNMutableNotificationContent()
      content.title = "Urgent"
      content.body = "Your account requires attention."
      content.interruptionLevel = .timeSensitive
      
      let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0, repeats: false)
      
      let request = UNNotificationRequest(identifier: "time-sensitive—example",
                                             content: content,
                                             trigger: trigger)
    • 11:20 - Time Sensitive Notification: Push

      // Time Sensitive
      // Push notification
      
      {
          "aps" : {
              "alert" : {
                  "title" : "Urgent",
                  "body" : "Your account requires attention."
              }
              "interruption-level" : "time-sensitive"
          }
      }
    • 15:20 - Notification Content Providing

      // New UserNotifications API
      
      @available(macOS 12.0, *)
      public protocol UNNotificationContentProviding : NSObjectProtocol {}
      
      open class UNNotificationContent : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
          // ...
      
          @available(macOS 12.0, *)
          open func updating(from provider: UNNotificationContentProviding) throws 
                                                          -> UNNotificationContent
      
          // ...
      }
    • 16:08 - Communication Notification: Incoming message

      // Create a messaging notification
      // In UNNotificationServiceExtension subclass
      
      func didReceive(_ request: UNNotificationRequest,
                      withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
          let incomingMessageIntent: INSendMessageIntent = // ...
          let interaction = INInteraction(intent: incomingMessageIntent, response: nil)
          interaction.direction = .incoming
          interaction.donate(completion: nil)
          do {
              let messageContent = try request.content.updating(from: incomingMessageIntent)
              contentHandler(messageContent)
          } catch {
             // Handle error
          }
      }
    • 16:20 - Communication Notification: Incoming call

      // Create a call notification
      // In UNNotificationServiceExtension subclass
      
      func didReceive(_ request: UNNotificationRequest,
                      withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
          let incomingCallIntent: INStartCallIntent = // ...
          let interaction = INInteraction(intent: incomingCallIntent, response: nil)
          interaction.direction = .incoming
          interaction.donate(completion: nil)
          do {
              let callContent = try request.content.updating(from: incomingCallIntent)
              contentHandler(callContent)
          } catch {
             // Handle error
          }
      }
    • 17:48 - Communication Notification: Outgoing message

      func sendMessage(...) {
          // ...
      
          let intent: INSendMessageIntent = // ...
          let interaction = INInteraction(intent: intent, response: nil)
      
          interaction.direction = .outgoing
          interaction.donate(completion: nil)
      }
    • 18:29 - Communication Notification: INPerson

      // Create INPerson
      
      let person = INPerson(personHandle: handle,
                          nameComponents: nameComponents,
                             displayName: displayName,
                                   image: image,
                       contactIdentifier: contactIdentifier,
                        customIdentifier: customIdentifier,
                                 aliases: nil,
                          suggestionType: suggestionType)
    • 18:43 - Communication Notification: INSendMessageIntent

      // Create INSendMessageIntent
      // In your notification service extension
      
      let intent = INSendMessageIntent(recipients: [person2],
                              outgoingMessageType: .outgoingMessageText,
                                          content: content,
                               speakableGroupName: speakableGroupName,
                           conversationIdentifier: conversationIdentifier,
                                      serviceName: serviceName,
                                           sender: person1,
                                      attachments: nil)
      
      let interaction = INInteraction(intent: intent, response: nil)
      interaction.direction = .incoming

Developer Footer

  • Vidéos
  • WWDC21
  • Send communication and Time Sensitive notifications
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines