MarketingCloudSDKEventDelegate

Objective-C

@protocol MarketingCloudSDKEventDelegate <NSObject>

Swift

protocol MarketingCloudSDKEventDelegate : NSObjectProtocol

Supporting protocol for In-App Messaging

Implementation of this protocol is not required for In-App Messaging to work, although it provides addition control for an application developer.

In-App messages are presented by the MobilePush SDK in an application’s context, inserted into the view hierarchy atop the application’s topmost view controller.

This protocol allows for awareness into the SDK’s lifecycle for In-App Messages.

  • Method called by the SDK when an In-App Message is ready to be shown. The delegate implementing this method returns YES or NO.

    YES indicates to the SDK that this message is able to be shown (allowed by the application).

    NO indicates that the SDK should not show this message. An application may return NO if its visual hierarchy or user flow is such that an interruption would not be acceptable to the usability or functionality of the application.

    If NO is returned, the application may capture the message’s identifier (via sfmc_messageIdForMessage:) and attempt to show that message later via sfmc_showInAppMessage:.

    Declaration

    Objective-C

    - (BOOL)sfmc_shouldShowInAppMessage:(NSDictionary *_Nonnull)message;

    Swift

    optional func sfmc_shouldShow(inAppMessage message: [AnyHashable : Any]) -> Bool

    Parameters

    message

    NSDictionary representing an In-App Message

    Return Value

    value reflecting application’s behavior

  • Method called by the SDK when an In-App Message has been shown.

    Declaration

    Objective-C

    - (void)sfmc_didShowInAppMessage:(NSDictionary *_Nonnull)message;

    Swift

    optional func sfmc_didShow(inAppMessage message: [AnyHashable : Any])

    Parameters

    message

    NSDictionary representing an In-App Message

  • Method called by the SDK when an In-App Message has been closed.

    Declaration

    Objective-C

    - (void)sfmc_didCloseInAppMessage:(NSDictionary *_Nonnull)message;

    Swift

    optional func sfmc_didClose(inAppMessage message: [AnyHashable : Any])

    Parameters

    message

    NSDictionary representing an In-App Message