Braze iOS SDK
Documentation for the Braze iOS SDK
 All Classes Functions Properties
Instance Methods | Properties | List of all members
ABKInAppMessage Class Reference

Instance Methods

(void) - logInAppMessageImpression
(void) - logInAppMessageClicked
(void) - setInAppMessageClickAction:withURI:
(nullable NSData *) - serializeToData


NSString * message
NSDictionary * extras
NSTimeInterval duration
ABKInAppMessageClickActionType inAppMessageClickActionType
NSURL * uri
BOOL openUrlInWebView
ABKInAppMessageDismissType inAppMessageDismissType
UIColor * backgroundColor
UIColor * textColor
NSString * icon
UIColor * iconColor
UIColor * iconBackgroundColor
BOOL enableDarkTheme
NSInteger overrideUserInterfaceStyle
NSURL * imageURI
UIViewContentMode imageContentMode
ABKInAppMessageOrientation orientation
NSTextAlignment messageTextAlignment
BOOL animateIn
BOOL animateOut
BOOL isControl

Method Documentation

- (void) logInAppMessageImpression

If you're handling in-app messages completely on your own, you should still report impressions and clicks on the in-app message back to Braze with these methods so that your campaign reporting features still work in the dashboard.

Note: Each in-app message can log at most one impression and at most one click.

- (nullable NSData *) serializeToData

Serializes the in-app message to binary data for use by wrappers such as Braze's Unity SDK for iOS.

- (void) setInAppMessageClickAction: (ABKInAppMessageClickActionType)  clickActionType
withURI: (nullable NSURL *)  uri 

This method will set the inAppMessageClickActionType property.

When clickActionType is ABKInAppMessageRedirectToURI, the parameter uri cannot be nil. When clickActionType is ABKInAppMessageDisplayNewsFeed or ABKInAppMessageNoneClickAction, the parameter uri will be ignored, and property uri will be set to nil.

Property Documentation

- (UIColor*) backgroundColor

backgroundColor defines the background color of the in-app message. The default background color is black with 0.9 alpha for ABKInAppMessageSlideup, and white with 1.0 alpha for ABKInAppMessageModal and ABKInAppMessageFull.

- (ABKInAppMessageDarkTheme*) darkTheme

Data model that contains all the dark theme color info for any visible views, including any buttons that may be present.

- (NSTimeInterval) duration

This property defines the number of seconds before the in-app message is automatically dismissed.

- (BOOL) enableDarkTheme

This boolean determines if the in-app message will attempt to use dark theme colors, granted the device is in dark mode and the fields are present in the response.

The default of this value is YES but can be overriden in beforeInAppMessageDisplayed: to ensure that the dark theme is disabled for any given in-app message.

- (NSDictionary*) extras

This property carries extra data in the form of an NSDictionary which can be sent down via the Braze Dashboard. You may want to design and implement a custom handler to access this data depending on your use-case.

- (NSString*) icon

icon the unicode string of the Font Awesome icon for this in-app message.

You may add Font Awesome icons to in-app messages from the Braze dashboard.

- (UIColor*) iconBackgroundColor

iconBackgroundColor defines the background color of icon property.

  • The default background color's RGB values are R:0 G:115 B:213.
- (UIColor*) iconColor

iconColor defines the font color of icon property. The default font color is white.

- (UIViewContentMode) imageContentMode

imageContentMode defines the content mode of the image on in-app message. For immersive in-app messages, the imageContentMode defines both the image icon and the graphic image's content mode.

The imageContentMode default values are: Slideup: UIViewContentModeScaleAspectFit Modal: UIViewContentModeScaleAspectFit Full: UIViewContentModeScaleAspectFill

- (NSURL*) imageURI

imageURI defines the URI of the image icon on in-app message. When there is a iconImage defined, the iconImage will be used and the value of property icon will be ignored.

- (ABKInAppMessageClickActionType) inAppMessageClickActionType

This property defines the action that will be performed when the in-app message is clicked. See the ABKInAppMessageClickActionType enum documentation above offers additional details.

- (ABKInAppMessageDismissType) inAppMessageDismissType

inAppMessageDismissType defines the dismissal behavior of the in-app message. See the above documentation for ABKInAppMessageDismissType for additional details.

- (BOOL) isControl

isControl defines whether this in-app message is a control. Control in-app messages should not be displayed to users.

- (NSString*) message

This property defines the message displayed within the in-app message.

- (NSTextAlignment) messageTextAlignment

messageTextAlignment defines the preferred text alignment of the message label. The default values are: Slideup: NSTextAlignmentNatural Modal: NSTextAlignmentCenter Full: NSTextAlignmentCenter

- (BOOL) openUrlInWebView

When the in-app message's inAppMessageClickActionType is ABKInAppMessageRedirectToURI, if the property is set to YES, the URI will be opened in a modal WKWebView inside the app. If this property is set to NO, the URI will be opened by the OS and web URIs will be opened in an external web browser app.

This property defaults to YES on ABKInAppMessageHTML subclasses and NO on all other ABKInAppMessage subclasses.

- (ABKInAppMessageOrientation) orientation

orientation defines the preferred screen orientation for the in-app message. In-app messages will only display if the preferred orientation matches the current status bar orientation. However, there is an important exception for iPads. For in-app messages that have a preferred orientation and are being displayed on an iPad, the in-app message will appear in the style of the preferred orientation regardless of actual screen orientation.

- (NSInteger) overrideUserInterfaceStyle

An optional UIUserInterfaceStyle that can be used to force dark or light mode.

The default value will not override OS settings but can be overriden in beforeInAppMessageDisplayed: to ensure that the dark or light theme is used for any given in-app message. This property is of type NSInteger to avoid any iOS version dependencies.

- (UIColor*) textColor

textColor defines the message text color of the in-app message. The default text color is black.

- (NSURL*) uri

When the in-app message's inAppMessageClickActionType is ABKInAppMessageRedirectToURI, clicking on the in-app message will redirect to the uri defined in this property.

This property can be a HTTP URI or a protocol URI.