Configure the Notification Content extension
With the AEPNotificationContent package now available after following the installation steps, the app and notification content extension must be configured to use it.
App configuration
-
Ensure the
AppDelegateimplementsUNUserNotificationCenterDelegate.@main class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { ... } -
In your
AppDelegate, after the user has granted your app permission to display notifications, create any custom notification actions needed by your app and register a category with identifierAEPNotification.let center = UNUserNotificationCenter.current() // ask user for permission to display notifications center.requestAuthorization(options: [.badge, .sound, .alert]) { [weak self] granted, _ in // return early if the user does not consent guard granted else { return } center.delegate = self // create a category with desired actions and `AEPNotification` as the identifier let myCategory = UNNotificationCategory(identifier: "AEPNotification", actions: [], intentIdentifiers: [], options: [.customDismissAction]) // register the category UNUserNotificationCenter.current().setNotificationCategories([myCategory]) // if not done elsewhere, register the app to receive remote notifications DispatchQueue.main.async { application.registerForRemoteNotifications() } }
Notification Content extension configuration
Update the Info.plist for your Notification Content extension with the following values:
Key
Type
Value
NSExtension.NSExtensionPrincipalClassStringAEPNotificationContent.AEPNotificationViewControllerNSExtension.NSExtensionAttributes.UNNotificationExtensionUserInteractionEnabledBooleanYESNSExtension.NSExtensionAttributes.UNNotificationExtensionDefaultContentHiddenBooleanYESNSExtension.NSExtensionAttributes.UNNotificationExtensionCategoryStringAEPNotificationNSExtension.NSExtensionAttributes.UNNotificationExtensionInitialContentSizeRatioNumber0.2
Next steps
Use a sample payload to generate a notification in your app by completing the steps in Validate AEPNotificationContent integration.