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.
func snr_registerForPushNotificationsIsNeeded() -> Void

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:activity:completionHandler:) 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, activity: SyneriseActivity, completionHandler: SyneriseActivityCompletionHandler)

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

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:activity:completionHandler:) 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, 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_notificationDidDissmis(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.


InjectorWalkthroughDelegate

A delegate to handle the states of walkthrough.

When you choose to load and present a walkthrough manually, you may be interested in the following delegate methods.

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

Injector.setWalkthroughDelegate(YOUR_OBJECT)
Note: All these methods are optional and implementing them is not required. They are also called when a walkthrough was loaded automatically.

snr_walkthroughDidLoad()

This method is called after a walkthrough is loaded.

Note: This method will be invoked when the snr_walkthroughDidLoad(walkthroughDictionary: [AnyHashable: Any]) method is not implemented.
func snr_walkthroughDidLoad()

snr_walkthroughDidLoad(walkthroughDictionary: [AnyHashable: Any])

This method is called after a walkthrough is loaded.

func snr_walkthroughDidLoad(walkthroughDictionary: [AnyHashable: Any])

Parameter Type Description
walkthroughDictionary [AnyHashable: Any] Dictionary representation of the walkthrough.

snr_walkthroughLoadingError(error: Error)

This method is called when an error occurs while loading a walkthrough.

func snr_walkthroughLoadingError(error: Error)

Parameter Type Description
error NSError The error that occurred.

snr_walkthroughDidAppear()

This method is called after a walkthrough appears.

func snr_walkthroughDidAppear()

snr_walkthroughDidDisappear()

This method is called after a walkthrough disappears.

func snr_walkthroughDidDisappear()



InjectorBannerDelegate

A delegate to handle the states of banner.

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

Injector.setBannerDelegate(YOUR_OBJECT)
Note: It’s not always suitable for you to cover the screen every time a banner is received. You can implement optional methods to control this.

snr_shouldBannerAppear(bannerDictionary: [AnyHashable: Any]) -> Bool

This method is called after a banner is loaded and Synerise SDK asks for permission to show it.

func snr_shouldBannerAppear(bannerDictionary: [AnyHashable: Any]) -> Bool

Parameter Type Description
bannerDictionary [AnyHashable: Any] Dictionary representation of the banner.

snr_bannerDidAppear()

This method is called after a banner appears.

func snr_bannerDidAppear()

snr_bannerDidDisappear()

This method is called after a banner disappears.

func snr_bannerDidDisappear()



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.

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.

This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.

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

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