iOS delegates
SyneriseDelegate
A delegate to handle the SDK lifecycle events.
To set your object as delegate, you must use this method.
Synerise.setDelegate(YOUR_OBJECT)
[SNRSynerise setDelegate:YOUR_OBJECT];
IMPORTANT: If optional methods for handling URL and deeplink are not implemented, SDK has a default behavior.
snr_initialized()
This method is called when the Synerise SDK is initialized.
func snr_initialized() -> Void
- (void)SNR_initialized
snr_initializationError(error: Error)
This method is called when an error occurs while initializing the Synerise SDK.
func snr_initializationError(error: Error) -> Void
- (void)SNR_initializationError:(NSError *)error
| Parameter | Type | Description |
|---|---|---|
| error | NSError | The error that occurred. |
snr_registerForPushNotificationsIsNeeded()
This method is called when Synerise needs registration for push notifications.
See Configuring push notifications for more details.
NOTE: After invoking this method, you must invoke the Client.registerForPush(registrationToken:mobilePushAgreement:success:failure:) method again.
NOTE: This method is invoked when the snr_registerForPushNotificationsIsNeeded(origin:) method is not implemented.
func snr_registerForPushNotificationsIsNeeded() -> Void
- (void)SNR_registerForPushNotificationsIsNeeded
snr_registerForPushNotificationsIsNeeded(origin: PushNotificationsRegistrationOrigin)
This method is called when Synerise needs registration for push notifications.
See Configuring push notifications for more details.
NOTE: After invoking this method, you must invoke the Client.registerForPush(registrationToken:mobilePushAgreement:success:failure:) method again.
func snr_registerForPushNotificationsIsNeeded(origin: PushNotificationsRegistrationOrigin) -> Void
- (void)SNR_registerForPushNotificationsIsNeededByOrigin:(SNRPushNotificationsRegistrationOrigin)origin
| Parameter | Type | Description |
|---|---|---|
| origin | PushNotificationsRegistrationOrigin | Origin of the push notifications registration from the SDK. |
snr_handledAction(url: URL)
This method is called when Synerise handles URL action from campaign activities.
NOTE: This method is invoked when the snr_handledAction(url:source:) method is not implemented.
func snr_handledAction(url: URL) -> Void
- (void)SNR_handledActionWithURL:(NSURL *)url
| Parameter | Type | Description |
|---|---|---|
| url | NSURL | URL value from the action of the activity. |
snr_handledAction(url: URL, source: SyneriseSource)
This method is called when Synerise handles URL action from campaign activities.
func snr_handledAction(url: URL, source: SyneriseSource) -> Void
- (void)SNR_handledActionWithURL:(NSURL *)url source:(SNRSyneriseSource)source
| Parameter | Type | Description |
|---|---|---|
| url | NSURL | URL value from the action of the activity. |
| source | SyneriseSource | Identifies Synerise campaign source (SyneriseSource). |
snr_handledAction(url: URL, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler)
This method is called when Synerise handles URL action from campaign activities.
NOTE: This method was deprecated in SDK version 5.0.0.
func snr_handledAction(url: URL, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler) -> Void
- (void)SNR_handledActionWithURL:(NSURL *)url activity:(SNRSyneriseActivity)activity completionHandler:(SNRSyneriseActivityCompletionHandler)completionHandler
| Parameter | Type | Description |
|---|---|---|
| url | NSURL | URL value from the action of the activity. |
| activity | SyneriseActivity | Identifies Synerise campaign activity (SyneriseActivity). |
| completionHandler | SyneriseActivityAction | A block/closure that should be invoked with SyneriseActivityAction parameters and a completion block to execute. |
snr_handledAction(deepLink: String)
This method is called when Synerise handles deeplink action from campaign activities.
NOTE: This method is invoked when the snr_handledAction(deepLink:source:) method is not implemented.
func snr_handledAction(deepLink: String) -> Void
- (void)SNR_handledActionWithDeepLink:(NSString *)deepLink
| Parameter | Type | Description |
|---|---|---|
| deepLink | String | Deep link value from the action of the activity. |
snr_handledAction(deepLink: String, source: SyneriseSource)
This method is called when Synerise handles deeplink action from campaign activities.
func snr_handledAction(deepLink: String, source: SyneriseSource) -> Void
- (void)SNR_handledActionWithDeepLink:(NSString *)deepLink source:(SNRSyneriseSource)source
| Parameter | Type | Description |
|---|---|---|
| deeplink | String | Deep link value from the action of the activity. |
| source | SyneriseSource | Identifies Synerise campaign source (SyneriseActivity). |
snr_handledAction(deepLink: String, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler)
This method is called when Synerise handles deeplink action from campaign activities.
NOTE: This method was deprecated in SDK version 5.0.0.
func snr_handledAction(deepLink: String, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler) -> Void
- (void)SNR_handledActionWithDeepLink:(NSString *)deepLink activity:(SNRSyneriseActivity)activity completionHandler:(SNRSyneriseActivityCompletionHandler)completionHandler
| Parameter | Type | Description |
|---|---|---|
| deeplink | String | Deep link value from the action of the activity. |
| activity | SyneriseActivity | Identifies Synerise campaign activity (SyneriseActivity). |
| completionHandler | SyneriseActivityAction | A block/closure that should be invoked with parameters: SyneriseActivityAction and completion block to execute. |
NotificationDelegate
A delegate to handle events from Synerise notifications.
See Configuring push notifications for more details.
NOTE: NotificationDelegate is available from 4.10.0 SDK version. All methods are optional.
To set your object as delegate, you must use this method.
Synerise.setNotificationDelegate(YOUR_OBJECT)
[SNRSynerise setNotificationDelegate:YOUR_OBJECT];
snr_notificationDidReceive(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is received.
snr_notificationDidReceive(notificationInfo: NotificationInfo)
- (void)SNR_notificationDidReceive:(SNRNotificationInfo *)notificationInfo
| Parameter | Type | Description |
|---|---|---|
| notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationDidDismiss(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is dismissed.
func snr_notificationDidDissmis(notificationInfo: NotificationInfo)
- (void)SNR_notificationDidDissmis:(SNRNotificationInfo *)notificationInfo
| Parameter | Type | Description |
|---|---|---|
| notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationClicked(notificationInfo: NotificationInfo)
This method is called when a Synerise notification is clicked.
func snr_notificationClicked(notificationInfo: NotificationInfo)
- (void)SNR_notificationClicked:(SNRNotificationInfo *)notificationInfo
| Parameter | Type | Description |
|---|---|---|
| notificationInfo | NotificationInfo | Object providing information about the notification. |
snr_notificationClicked(notificationInfo: NotificationInfo, actionButton: String)
This method is called when an action button is clicked in a Synerise notification.
func snr_notificationClicked(notificationInfo: NotificationInfo, actionButton: String)
- (void)SNR_notificationActionButtonClicked:(SNRNotificationInfo *)notificationInfo actionButton:(NSString *)actionButton
| Parameter | Type | Description |
|---|---|---|
| notificationInfo | NotificationInfo | Object providing information about the notification. |
| actionButton | String | Text on the clicked action button. |
ClientStateDelegate
A delegate to handle customer's sign-in state changes.
To set your object as delegate, you must use this method.
Client.setClientStateDelegate(YOUR_OBJECT)
[SNRClient setClientStateDelegate:YOUR_OBJECT];
snr_clientIsSignedIn()
This method is called when a customer signs in.
func snr_clientIsSignedIn()
- (void)SNR_clientIsSignedIn
snr_clientIsSignedOut(reason: ClientSessionEndReason)
This method is called when a customer signs out.
func snr_clientIsSignedOut(reason: ClientSessionEndReason)
- (void)SNR_clientIsSignedOutWithReason:(SNRClientSessionEndReason)reason
| Parameter | Type | Description |
|---|---|---|
| reason | ClientSessionEndReason | Specifies the reason for signing out. |
InjectorInAppMessageDelegate
A delegate to handle the states of in-app message.
NOTE: InjectorInAppMessageDelegate is available from 4.6.0 SDK version.
To set your object as delegate, you must use this method.
Injector.setInAppMessageDelegate(YOUR_OBJECT)
[SNRInjector setInAppMessageDelegate:YOUR_OBJECT];
snr_shouldInAppMessageAppear(data: InAppMessageData) -> Bool
This method is called after an in-app message is loaded and Synerise SDK asks for permission to show it.
func snr_shouldInAppMessageAppear(data: InAppMessageData) -> Bool
- (BOOL)SNR_shouldInAppMessageAppear:(SNRInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidAppear(data: InAppMessageData)
This method is called after an in-app message appears.
func snr_inAppMessageDidAppear(data: InAppMessageData)
- (void)SNR_inAppMessageDidAppear:(SNRInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidDisappear(data: InAppMessageData)
This method is called after an in-app message disappears.
func snr_inAppMessageDidDisappear(data: InAppMessageData)
- (void)SNR_inAppMessageDidDisappear:(SNRInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageDidChangeSize(rect: CGRect)
This method is called when an in-app message changes its size.
func snr_inAppMessageDidChangeSize(rect: CGRect)
- (void)SNR_inAppMessageDidChangeSize:(CGRect)rect
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageContextIsNeeded(data: InAppMessageData) -> [AnyHashable: Any]?
This method is called when an individual context (for example a profile ID, an item SKU) for an in-app message is needed.
func snr_inAppMessageContextIsNeeded(data: InAppMessageData) -> [AnyHashable: Any]?
- (nullable NSDictionary *)SNR_inAppMessageContextIsNeeded:(SNRInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
snr_inAppMessageHandledAction(data: InAppMessageData, deepLink: String)
This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.
NOTE: This method was renamed in 5.0.0 SDK version from snr_inAppMessageHandledAction(data:deeplink:).
func snr_inAppMessageHandledAction(data: InAppMessageData, deepLink: String)
- (void)SNR_inAppMessageHandledDeeplinkAction:(SNRInAppMessageData *)data deepLink:(NSString *)deepLink
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
| deepLink | String | Deep link value from the action of the activity. |
snr_inAppMessageHandledAction(data: InAppMessageData, url: URL)
This method is called when the SRInApp.openUrl(url) method is used in an in-app message.
func snr_inAppMessageHandledAction(data: InAppMessageData, url: URL)
- (void)SNR_inAppMessageHandledURLAction:(SNRInAppMessageData *)data url:(NSURL *)url
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
| url | URL | URL value from the action of the activity. |
snr_inAppMessageHandledCustomAction(data: InAppMessageData, name: String, parameters: [AnyHashable: Any])
This method is called when the SRInApp.handleCustomAction(name, params) method is used in an in-app message.
func snr_inAppMessageHandledCustomAction(data: InAppMessageData, name: String, parameters: [AnyHashable: Any])
- (void)SNR_inAppMessageHandledCustomAction:(SNRInAppMessageData *)data name:(NSString *)name parameters:(NSDictionary *)parameters
| Parameter | Type | Description |
|---|---|---|
| data | InAppMessageData | Model representation of the in-app message. |
| name | String | Custom action name for identification. |
| parameters | [AnyHashable: Any] | Custom action parameters. |
InjectorInlineInAppMessageDelegate
A delegate to handle global events for inline in-app messages.
To set your object as delegate, you must use this method.
Injector.setInlineInAppMessageDelegate(YOUR_OBJECT)
[SNRInjector setInlineInAppMessageDelegate:YOUR_OBJECT];
snr_inlineInAppMessageDidBecomeAvailable(view: InlineInAppView, data: InlineInAppMessageData)
This method is called when the SDK creates a ready-to-display component after an event-based trigger for a placement with no existing host view.
func snr_inlineInAppMessageDidBecomeAvailable(view: InlineInAppView, data: InlineInAppMessageData)
- (void)SNR_inlineInAppMessageDidBecomeAvailable:(SNRInlineInAppView *)view data:(SNRInlineInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The ready-to-display inline in-app view. |
| data | InlineInAppMessageData | Inline in-app message data. |
snr_inlineInAppMessageContextIsNeeded(data: InlineInAppMessageData) -> [AnyHashable: Any]?
This method is called when a per-message context is needed for rendering.
func snr_inlineInAppMessageContextIsNeeded(data: InlineInAppMessageData) -> [AnyHashable: Any]?
- (nullable NSDictionary *)SNR_inlineInAppMessageContextIsNeeded:(SNRInlineInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| data | InlineInAppMessageData | Inline in-app message data. |
snr_inlineInAppMessageHandledAction(data: InlineInAppMessageData, url: URL)
This method is called when the SRInApp.openUrl(url) method is used in an in-app message.
func snr_inlineInAppMessageHandledAction(data: InlineInAppMessageData, url: URL)
- (void)SNR_inlineInAppMessageHandledURLAction:(SNRInlineInAppMessageData *)data url:(NSURL *)url
| Parameter | Type | Description |
|---|---|---|
| data | InlineInAppMessageData | Inline in-app message data. |
| url | URL | The URL to open. |
snr_inlineInAppMessageHandledAction(data: InlineInAppMessageData, deepLink: String)
This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.
func snr_inlineInAppMessageHandledAction(data: InlineInAppMessageData, deepLink: String)
- (void)SNR_inlineInAppMessageHandledDeeplinkAction:(SNRInlineInAppMessageData *)data deepLink:(NSString *)deepLink
| Parameter | Type | Description |
|---|---|---|
| data | InlineInAppMessageData | Inline in-app message data. |
| deepLink | String | The deep link value. |
snr_inlineInAppMessageHandledCustomAction(data: InlineInAppMessageData, name: String, parameters: [AnyHashable: Any])
This method is called when the SRInApp.handleCustomAction(name, params) method is used in an in-app message.
func snr_inlineInAppMessageHandledCustomAction(data: InlineInAppMessageData, name: String, parameters: [AnyHashable: Any])
- (void)SNR_inlineInAppMessageHandledCustomAction:(SNRInlineInAppMessageData *)data name:(NSString *)name parameters:(NSDictionary *)parameters
| Parameter | Type | Description |
|---|---|---|
| data | InlineInAppMessageData | Inline in-app message data. |
| name | String | Custom action name. |
| parameters | [AnyHashable: Any] | Custom action parameters. |
snr_inlineInAppMessageHandledCustomMethod(data: InlineInAppMessageData, name: String, parameters: [AnyHashable: Any], completion: InAppCustomMethodCompletion)
This method is called when the SRInApp.customMethod(name, params) method is used in an in-app message. Resolve the completion exactly once with success or failure.
func snr_inlineInAppMessageHandledCustomMethod(data: InlineInAppMessageData, name: String, parameters: [AnyHashable: Any], completion: InAppCustomMethodCompletion)
- (void)SNR_inlineInAppMessageHandledCustomMethod:(SNRInlineInAppMessageData *)data name:(NSString *)name parameters:(NSDictionary *)parameters completion:(SNRInAppCustomMethodCompletion *)completion
| Parameter | Type | Description |
|---|---|---|
| data | InlineInAppMessageData | Inline in-app message data. |
| name | String | Custom method name. |
| parameters | [AnyHashable: Any] | Custom method parameters. |
| completion | InAppCustomMethodCompletion | Completion to resolve with success() or failure(). |
InlineInAppViewDelegate
A per-component delegate to handle the lifecycle of an inline in-app message view.
snr_inlineInAppViewDidStartProcessing(view: InlineInAppView)
This method is called when the SDK starts processing a campaign for this component.
func snr_inlineInAppViewDidStartProcessing(view: InlineInAppView)
- (void)SNR_inlineInAppViewDidStartProcessing:(SNRInlineInAppView *)view
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
snr_inlineInAppViewDidLoad(view: InlineInAppView, data: InlineInAppMessageData)
This method is called when the inline in-app message content is loaded for the first time.
func snr_inlineInAppViewDidLoad(view: InlineInAppView, data: InlineInAppMessageData)
- (void)SNR_inlineInAppViewDidLoad:(SNRInlineInAppView *)view data:(SNRInlineInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
| data | InlineInAppMessageData | Inline in-app message data. |
snr_inlineInAppViewDidUpdate(view: InlineInAppView, data: InlineInAppMessageData)
This method is called when the inline in-app message content is updated with a new campaign.
func snr_inlineInAppViewDidUpdate(view: InlineInAppView, data: InlineInAppMessageData)
- (void)SNR_inlineInAppViewDidUpdate:(SNRInlineInAppView *)view data:(SNRInlineInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
| data | InlineInAppMessageData | Inline in-app message data. |
snr_inlineInAppViewDidFail(view: InlineInAppView, error: Error)
This method is called when the inline in-app message content fails to load or render.
func snr_inlineInAppViewDidFail(view: InlineInAppView, error: Error)
- (void)SNR_inlineInAppViewDidFail:(SNRInlineInAppView *)view error:(NSError *)error
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
| error | Error | The error that occurred. |
snr_inlineInAppViewChangeSizeIsNeeded(view: InlineInAppView, data: InlineInAppMessageData, size: InlineInAppSize)
This method is called when the in-app message content requests a size change via the SRInApp.setComponentSize(width, height) JS method. The measured size is delivered as an InlineInAppSize, exposing it in physical pixels, points, and as a fraction of the device screen.
func snr_inlineInAppViewChangeSizeIsNeeded(view: InlineInAppView, data: InlineInAppMessageData, size: InlineInAppSize)
- (void)SNR_inlineInAppViewChangeSizeIsNeeded:(SNRInlineInAppView *)view data:(SNRInlineInAppMessageData *)data size:(SNRInlineInAppSize *)size
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
| data | InlineInAppMessageData | Inline in-app message data. |
| size | InlineInAppSize | The requested size. Exposes widthPx/heightPx (physical pixels), widthPt/heightPt (points), and widthScreenRatio/heightScreenRatio (0..1 fraction of the screen). |
snr_inlineInAppViewShouldBeRemoved(view: InlineInAppView, data: InlineInAppMessageData)
This method is called when the in-app message content requests removal from the view hierarchy via the SRInApp.close() or SRInApp.closeAndTrigger() JS method.
func snr_inlineInAppViewShouldBeRemoved(view: InlineInAppView, data: InlineInAppMessageData)
- (void)SNR_inlineInAppViewShouldBeRemoved:(SNRInlineInAppView *)view data:(SNRInlineInAppMessageData *)data
| Parameter | Type | Description |
|---|---|---|
| view | InlineInAppView | The inline in-app view. |
| data | InlineInAppMessageData | Inline in-app message data. |
TrackerDelegate
A delegate to handle events from the Tracker.
To set your object as delegate, you must use this method.
Tracker.setDelegate(YOUR_OBJECT)
[SNRTracker setDelegate:YOUR_OBJECT];
snr_locationUpdateRequired()
This method is called when the Tracker module requests a location update.
func snr_locationUpdateRequired()
- (void)SNR_locationUpdateRequired
NotificationServiceExtensionDelegate
A delegate to handle events from Notification Extension Service.
NOTE: NotificationServiceExtensionDelegate is available from 4.0.0 SDK version.
To set your object as delegate, you must use this code in your Notification Service Extension.
NotificationServiceExtension.setDelegate(YOUR_OBJECT)
[SNRNotificationServiceExtension setDelegate:YOUR_OBJECT];
notificationServiceExtensionDidFailDecryptionWithError(_: Error)
This method is called when the decryption process fails.
func notificationServiceExtensionDidFailDecryptionWithError(_: Error)
- (void)notificationServiceExtensionDidFailDecryptionWithError:(NSError *)error
| Parameter | Type | Description |
|---|---|---|
| error | NSError | The error that occurred |
notificationServiceExtensionDidFailProcessingWithError(_: Error)
This method is called when the processing notification operation fails.
func notificationServiceExtensionDidFailProcessingWithError(_: Error)
- (void)notificationServiceExtensionDidFailProcessingWithError:(NSError *)error
| Parameter | Type | Description |
|---|---|---|
| error | NSError | The error that occurred |
ContentWidgetDelegate
A delegate to handle Content Widget actions.
To set your object as delegate, you must use this code below.
let widget = ContentWidget(options: widgetOptions, appearance: widgetAppearance)
widget.delegate = YOUR_OBJECT
SNRContentWidget *widget = [SNRContentWidget initWithOptions:options andAppearance:appearance];
widget.delegate = YOUR_OBJECT;
snr_widgetDidLoad(widget: ContentWidget)
This method is called after a widget is loaded.
func snr_widgetDidLoad(widget: ContentWidget)
- (void)SNR_widgetDidLoad:(SNRContentWidget *)widget
| Parameter | Type | Description |
|---|---|---|
| widget | ContentWidget | The widget instance that called the delegate method. |
snr_widgetDidNotLoad(widget:ContentWidget error: Error)
This method is called when an error occurs while loading a widget.
func snr_widgetDidNotLoad(widget:ContentWidget error: Error)
- (void)SNR_widget:(SNRContentWidget *)widget didNotLoadWithError:(NSError *)error
| Parameter | Type | Description |
|---|---|---|
| widget | ContentWidget | The widget instance that called the delegate method. |
| error | NSError | The error that occurred. |
snr_widgetDidReceiveClickAction(widget:ContentWidget model: BaseModel)
This method is called when the customer clicks a widget’s item.
func snr_widgetDidReceiveClickAction(widget:ContentWidget model: BaseModel)
- (void)SNR_widget:(SNRContentWidget *)widget didReceiveClickActionForModel:(SNRBaseModel *)model
| Parameter | Type | Description |
|---|---|---|
| widget | ContentWidget | The widget instance that called the delegate method. |
| model | BaseModel | The model's object that was clicked. |
snr_widgetIsLoading(widget: ContentWidget isLoading: Bool)
This method is called when the widget’s loading state changes.
func snr_widgetIsLoading(widget: ContentWidget isLoading: Bool)
- (void)SNR_widget:(SNRContentWidget *)widget isLoading:(BOOL)isLoading
| Parameter | Type | Description |
|---|---|---|
| widget | ContentWidget | The widget instance that called the delegate method. |
| isLoading | Bool | Widget's loading state. |
snr_widgetDidChangeSize(widget: ContentWidget size: CGSize)
This method is called when the widget’s size changes.
func snr_widgetDidChangeSize(widget: ContentWidget size: CGSize)
- (void)SNR_widget:(SNRContentWidget *)widget didChangeToSize:(CGSize)size
| Parameter | Type | Description |
|---|---|---|
| widget | ContentWidget | The widget instance that called the delegate method. |
| size | CGSize | Widget's new size. |
InjectorWalkthroughDelegate
NOTE: InjectorWalkthroughDelegate was removed in 5.0.0 SDK version.
InjectorBannerDelegate
NOTE: InjectorBannerDelegate was removed in 5.0.0 SDK version.