Getting Started
1. Install the SDK
Cocoapods
The easiest way to use Antsomi in your iOS project is with CocoaPods. Before you begin, please ensure that you are using Ruby v2.0.0 or higher (knowledge of Ruby syntax isn’t needed to install the SDK).
Step 1: Download CocoaPods
CocoaPods is a dependency manager for Swift and Objective-C projects. You can install CocoaPods by running the following command.
$ sudo gem install cocoapodsPlease refer to the CocoaPods Troubleshooting Guide in case you have trouble using CocoaPods.
Step 2: Add a Podfile
In the terminal, navigate to your Xcode project directory and create a Podfile by running the following command.
$ pod initStep 3: Edit your Podfile
Add the following in your Podfile under your project's target.
# Avoid use_frameworks! declaration in your Podfile.
target 'YourAppTarget' do
pod 'AntsomiFramework', '1.1.59'
endStep 4: Install AntsomiFramework SDK
To install the Antsomi SDK, navigate to your Xcode project directory and run the following command.
$ pod installStep 5: Stop using your project file, YOUR-PROJECT-NAME.xcodeproj. And start using the project workspace file created by CocoaPods, YOUR-PROJECT-NAME.xcworkspace from now on.
Doing so will ensure that the AntsomiFramework SDK is properly loaded.
2. Initialize the SDK
Step 1: Add Antsomi.Configuration to the application:didFinishLaunchingWithOptions: of your AppDelegate.
We recommend that you make this call at the end of
didFinishLaunchingWithOptions:.
Step 2: Add registerForNotification to the application:didRegisterForRemoteNotificationsWithDeviceToken: of your AppDelegate.
import AntsomiFramework
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
/**
YOUR CODE GOES HERE
**/
let config = Antsomi.Configuration(portalId: "XXXXXXXXX", propsId: "YYYYYYYYY", appGroupId: "group.antsomi.news",applicationId: "b25d06f4-d322-46d5-b323-ZZZZZZZZZZZZ")
Antsomi.shared.activate(with: config)
Antsomi.shared.trackAppLaunch()
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Antsomi.shared.registerForNotification(deviceToken)
}#import <AntsomiFramework/AntsomiFramework-Swift.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/**
YOUR CODE GOES HERE
**/
return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
Antsomi const *antsomi = [Antsomi shared];
[antsomi registerForNotification: deviceToken];
}You have successfully integrated the Antsomi SDK with your iOS app and are sending user session and system events data to your Antsomi account. Please note that it may take a up to few minutes for your data to reflect on your dashboard.
Last updated