Developer Guide
API GuideDeveloper Guide
  • Overview
    • Getting Started
    • Customers and Visitors
    • Events and Business Objects (BOs)
      • Sample Event Templates
  • Website
    • Getting Started
      • Direct JS Implementation
      • JS Integration via GTM
      • Tracking Haravan website events
    • Tracking Users
    • Tracking Events
      • [Direct] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
      • [GTM] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
    • Web Push
  • Android
    • Getting Started
    • Tracking Users
    • Tracking Events
    • Push Messaging
    • App Inbox Messaging
  • iOS
    • Getting Started
      • Integration of Antsomi iOS SDK
    • Tracking Users
    • Tracking Events
    • Push Messaging
  • Hybrid Apps
    • React Native
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Apply Promotion Code
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
    • Flutter
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
      • App In-line Content
  • Antsomi Service Integrations
    • Media Template
    • Media JSON
      • Sample E-Commerce Events
        • Search for Product(s)
        • View Product
        • Add a Product to the Shopping Cart
        • Checkout Shopping Cart
        • Purchase Product(s)
      • Sample User Events
        • Sign-in
        • Sign-up
      • Sample Opt-in Events
        • Subscribe to Email marketing
        • Subscribe to OneSignal channel
  • 3rd Party Integrations
    • Shopify
      • Tracking Shopify website events
    • LINE
      • Integrating LINE Login with your web app
    • Google Ad Manager
      • Targeting CDP365 segment via PPID(s)
Powered by GitBook
On this page
  • 1. Install the SDK
  • 2. Initialize the SDK
  1. iOS

Getting Started

PreviousApp Inbox MessagingNextIntegration of Antsomi iOS SDK

Last updated 1 year ago

1. Install the SDK

Cocoapods

The easiest way to use Antsomi in your iOS project is with . Before you begin, please ensure that you are using 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 cocoapods

Please refer to the 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 init

Step 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'
end

Step 4: Install AntsomiFramework SDK

To install the Antsomi SDK, navigate to your Xcode project directory and run the following command.

$ pod install

Step 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.

If you haven't had your CDP365 Application ID, please follow this .

CocoaPods
Ruby v2.0.0
CocoaPods Troubleshooting Guide
instruction