iOS

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

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.

After invoking this method, you must invoke the Client.registerForPush(registrationToken:mobilePushAgreement:success:failure:) method again.

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.

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.

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.

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.

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

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.

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

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

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.

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.

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.

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

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.


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.

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

InjectorWalkthroughDelegate was removed in 5.0.0 SDK version.



InjectorBannerDelegate

InjectorBannerDelegate was removed in 5.0.0 SDK version.

Canonical URL: https://hub.synerise.com/developers/mobile-sdk/listeners-and-delegates/ios-delegates