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)
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

snr_initializationError(error: Error)

This method is called when an error occurs while initializing the Synerise SDK.

func snr_initializationError(error: Error) -> Void

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

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
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
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

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
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.

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
Parameter Type Description
deepLink String Deep link value from the action of the activity.

This method is called when Synerise handles deeplink action from campaign activities.

func snr_handledAction(deepLink: String, source: SyneriseSource) -> Void
Parameter Type Description
deeplink String Deep link value from the action of the activity.
source SyneriseSource Identifies Synerise campaign source (SyneriseActivity).

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
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)

snr_notificationDidReceive(notificationInfo: NotificationInfo)

This method is called when a Synerise notification is received.

snr_notificationDidReceive(notificationInfo: 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)

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)

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)
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)

snr_clientIsSignedIn()

This method is called when a customer signs in.

func snr_clientIsSignedIn()

snr_clientIsSignedOut(reason: ClientSessionEndReason)

This method is called when a customer signs out.

func snr_clientIsSignedOut(reason: ClientSessionEndReason)

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)

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

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)

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)

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)

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]?

Parameter Type Description
data InAppMessageData Model representation of the in-app message.

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)
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)

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])

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.


TrackerDelegate

A delegate to handle events from the Tracker.

To set your object as delegate, you must use this method.

Tracker.setDelegate(YOUR_OBJECT)

snr_locationUpdateRequired()

This method is called when the Tracker module requests a location update.

func 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)

notificationServiceExtensionDidFailDecryptionWithError(_: Error)

This method is called when the decryption process fails.

func notificationServiceExtensionDidFailDecryptionWithError(_: 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)

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

snr_widgetDidLoad(widget: ContentWidget)

This method is called after a widget is loaded.

func snr_widgetDidLoad(widget: ContentWidget)

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)

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)

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)

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)

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.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker