importBatchimportBatchMixpanelSwiftDispatcher// or import BatchMixpanelObjcDispatcherimportMixpanel@UIApplicationMainclassAppDelegate:UIResponder, UIApplicationDelegate {funcapplication(_application: UIApplication,didFinishLaunchingWithOptionslaunchOptions: [UIApplication.LaunchOptionsKey:Any]?) ->Bool {// Find your mixpanel setup line, which looks like this:let mixpanel = Mixpanel.initialize(token:"MIXPANEL_TOKEN")// Objective-C Mixpanel SDK users: let mixpanel = Mixpanel.sharedInstance(withToken: "MIXPANEL_TOKEN")let mixpanelDispatcher = BatchMixpanelSwiftDispatcher.instance// If you're using BatchMixpanelObjcDispatcher, comment the previous lines and uncomment the next one// let mixpanelDispatcher = BatchMixpanelObjcDispatcher.instance()// Tell Batch about your Mixpanel instance to enable tracking mixpanelDispatcher.mixpanelInstance = mixpanel BatchEventDispatcher.add(mixpanelDispatcher) [...] BatchSDK.start(withAPIKey:"YOUR_API_KEY")returntrue }}
// MYAppDelegate.m
@import Batch;
@import BatchMixpanelObjcDispatcher;
@import Mixpanel;
@implementation MYAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Find your mixpanel setup line, which looks like this:
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:@"MIXPANEL_TOKEN"];
// BatchMixpanelSwiftDispatcher isn't supported from Objective-C
BatchMixpanelObjcDispatcher *mixpanelDispatcher = [BatchMixpanelObjcDispatcher instance];
// Tell Batch about your Mixpanel instance to enable tracking
mixpanelDispatcher.mixpanelInstance = mixpanel;
[BatchEventDispatcher addDispatcher:mixpanelDispatcher];
[...]
[BatchSDK startWithAPIKey:@"MY_API_KEY"];
return YES;
}
@end
Once your dispatcher is installed, restart your app and you should see something like this in your log:
If you can't find the line in your log, it may be due to missing dependencies, be sure to add the AT Internet and/or Firebase Analytics SDKs to your project.