Initialization

To initialize the SDK you have to add MBAudience to the array of plugins of MBurger.

import MBurgerSwift
import MBMessagesSwift

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    MBManager.shared.apiToken = "YOUR_API_TOKEN"
    MBManager.shared.plugins = [MBAudience()]

    return true
}

You can set a delegate when initializing the MBAudience plugin, the delegate will be called when audience data are sent successfully to the sever or if the sync fails

let audiencePlugin = MBAudience(delegate: [the delegate])

Last updated