To integrate with mParticle via CocoaPods, the following steps will need to be taken.
1. Add a Podfile
In terminal, navigate to your app's directory. Add a podfile to your app by running the following command:
$ pod init
Open your podfile by running the following command:
$ open -a Xcode Podfile
2. Inserting and Installing the mParticle-Leanplum
Insert the following line of code into your Podfile:
You will also need to include:
Your podfile should look like the following:
Now, install the Pods by running the following command:
$ pod install
3. Setting up AppDelegate
Then, to appropriately run mParticle, you will need to set your AppDelegate as follows:
You will need to include:
#if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
In your AppDelegate.h
Then, in your AppDelegate.m, you will need to add:
# import <Leanplum/Leanplum.h>
In order to call any Leanplum advance feature. Additionally, you will need to include:
MParticle sharedInstance] startWithKey:@"KEY_GOES_HERE"
In didFinishLaunchingWithOptions. This call automatically calls Leanplum Start. After this call, you can call Leanplum calls such as [Leanplum setUserId:@"exampleUser"];
As reference, your AppDelegate.m could appear as follows:
If you have any questions, please feel free to email email@example.com.