SFMCNotificationService
Objective-C
@interface SFMCNotificationService : UNNotificationServiceExtensionSwift
class SFMCNotificationService : UNNotificationServiceExtensionThe primary class for handling notification service extensions.
SFMCNotificationService should be used as the base class for
notification service extensions.
Note
Important: Do not implement anyUNNotificationServiceExtension methods, including:
- didReceive(_:withContentHandler:)
- serviceExtensionTimeWillExpire()
Implementing these methods may interfere with the expected behavior
of SFMCNotificationService, potentially leading to unexpected issues.
- 
                  
                  Override and implement this method to provide custom configuration option. The default implementation provides a logging level configruration option of .none- see: LogLevel.DeclarationObjective-C - (nonnull SFMCNotificationServiceConfig *)sfmcProvideConfig;Swift func sfmcProvideConfig() -> SFMCNotificationServiceConfig
- 
                  
                  Processes incoming push notifications and allows custom modifications. Override this method to customize push notification handling, such as: - Enabling/Disabling logging and adjusting log levels.
- Downloading and attaching media (images, videos) to the notification.
- Adding custom key-value pairs to userInfoin the push payload.
- Performing other necessary operations based on business requirements. 
 Note Important Considerations: - Do not modify - mutableContent.request.content.userInfodirectly, as it may cause an exception. Instead, pass custom key-value pairs via- contentHandler, e.g.,- contentHandler(@{@"customKey": @"customValue"}).
- Limited execution time: The notification service extension has a restricted execution window, so keep your custom processing as short as possible. 
- Always call the completion handler in every possible execution path to avoid timeouts. 
 DeclarationObjective-C - (void)sfmcDidReceiveRequest:(nonnull UNNotificationRequest *)request mutableContent: (nonnull UNMutableNotificationContent *)mutableContent withContentHandler: (nonnull void (^)(NSDictionary *_Nullable))contentHandler;Swift func sfmcDidReceive(_ request: UNNotificationRequest, mutableContent: UNMutableNotificationContent, withContentHandler contentHandler: @escaping ([AnyHashable : Any]?) -> Void)ParametersrequestThe original notification request. mutableContentA mutable notification content object that can be modified. contentHandlerA completion handler that must be called with the modified content. 
 SFMCNotificationService Class Reference
        SFMCNotificationService Class Reference