Initialization
To initialize the SDK you have to add MBMessagesSwift
to the array of plugins of MBurger
.
Then you have to tell MBManager.shared that the app has been opened with MBManager.shared.applicationDidFinishLaunchingWithOptions(launchOptions: launchOptions)
, this will trigger all the startup actions of the MBurger plugins. Once you've done this in app messages will be fetched automatically at the startup of the application and showed, if they need to be showed.
Initialize MBMessages with parameters
You can set a couples of parameters when initializing the MBMessages
plugin:
messagesDelay: it's the time after which the messages will be displayed once fetched
debug: if this is set to
true
, all the message returned by the server will be displayed, if this is set tofalse
a message will appear only once for app installation. This isfalse
by defaultdelegate: the delegate will receive a call if the fetch of the messages fails, with the error that caused the fail, see MBMessagesDelegate for more details.
viewDelegate: the view delegates will receive calls when views of messages are showed or hidden, it will also receives a call when the button of the views will be touched, so you need to implement this protocol if you want to open an in-app link from an in app message. See MBInAppMessageViewDelegate for a detailed description of the protocol.
styleDelegate: you can use this protocol to specify colors and fonts of the in app messages. See Stylize in app messages for more details
Automation
If messages have automation enabled they will be ignored and managed by the MBAutomationSwift SDK so make sure to include and configure the automation SDK correctly.
Last updated