To install the Freshpaint iOS SDK, add the following to your app's Podfile:
Copy pod 'Freshpaint', '0.2.1'
Then run:
Copy pod install --repo-update
To import the Freshpaint SDK use:
Swift Objective-C
Copy #import <FreshpaintSDK/FPAnalytics.h>
Then to initialize the SDK, add the following code to your application delegate's didFinishLaunchingWithOptions
:
Swift Objective-C
Copy func application(
_ application: UIApplication,
didFinishLaunchingWithOptions
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
let config = FreshpaintConfiguration(writeKey: "<your environment id>");
config.trackApplicationLifecycleEvents = true
config.recordScreenViews = true
Freshpaint.setup(with: config)
...
}
Copy - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
FPAnalyticsConfiguration *configuration = [FPAnalyticsConfiguration configurationWithWriteKey:@"<your environment id>"];
configuration.trackApplicationLifecycleEvents = YES;
configuration.recordScreenViews = YES;
[FPAnalytics setupWithConfiguration:configuration];
...
}
You can get your environment id by going to the Freshpaint sources page .
Verifying Your Instrumentation
To verify your Freshpaint installation, navigate to the Freshpaint Live View . After opening your app, you should see an Application Opened
event show up in Live View:
Note, the Freshpaint SDK batches events, so it can take a minute for the event to show up.