Integration

Prerequisites

  • Install Xcode version 9.0 or later.
  • Install Pod version 1.5.3 or later.
  • Open your project in Xcode.
  • Your project must target iOS 9.0 or later.
  • Swift projects must use Swift 4.0 or later.

Requirements

Apptics versionMinimum OS versionMinimum macOS versionMinimum tvOS versionMinimum watchOS versionXcode version
1.xiOS 9.0macOS 10.8tvOS 9.0watchOS 2.0Xcode 11+
  • For Objective C 'pod Apptics-SDK'.
  • For Swift 'pod Apptics-Swift'.
  • Add Apptics SDK to your app.
  • Before you can add Zoho Apptics to your iOS app, you need to create a Project and add your app in Apptics.
  • Once you have created the project and added your app, download the apptics-config.plist, and move the file to the project root.
  • Add the config file to all the targets.

Installation

You can install the Apptics library to your project via the different methods that are available.

Install with Cocoapod

Specify pod 'Apptics-SDK' in your Podfile to integrate Apptics into the Xcode project.

The Podfile will look something like this.

Copiedsource 'https://github.com/CocoaPods/Specs.git'
  target 'TARGET NAME' do
    pod 'Apptics-SDK'

    # Pre build script will register the app version, upload dSYM file to the server and add apptics specific information to the main info.plist which will be used by the SDK.
    script_phase :name => 'Apptics pre build', :script => 'sh "./Pods/Apptics-SDK/scripts/run" --upload-symbols-for-configurations="Release, Appstore"', :execution_position => :before_compile            

  end

Important:

  • Adding pre-build scripts is mandatory.
  • In the pre-build script, we upload dSYM to the server (optional), register the app with the Apptics server.
  • Always make sure 'Copy Bundle Resources' below the 'Compile Sources' and '[cp-user] Apptics pre build' is above 'Compile Sources'.

Build script usage

run --upload-symbols-for-configurations="Release, Appstore" --config-file-path="apptics-config.plist" --app-group-identifier="group.com.company.application [Optional]" --log-file-path="<FOLDER_PATH>/<FILE_NAME>.txt"

  • --config-file-path pass your config file path if it is not added to your project root.
  • --app-group-identifier if you have enabled app group identifier for your app's target.
  • --upload-symbols-for-configurations String, an optional parameter to pass your configuration name debug, release, or add a custom name with comma-separated for which the dSYMs will be uploaded without any prompt during App Store submission process via CI, CT, and CD.
  • --upload-symbols-for-frameworks String, optional parameter to pass to your third-party frameworks for which the dSYMs should be uploaded to the Apptics server, pass the names separated by a comma. For eg., AFNetworking, SwiftyJSON.
    Note: By default only main applications dSYM will be uploaded to Apptics.
  • --log-file-path String, optional parameter to pass the custom file path where you want the async dsym_upload operation logs should be written.
  • Run pod install and make sure that you are connected to the internet.
  • Use a user-defined variable or the environment variable of your XCConfig to pass the values to the parameter mentioned above.

Configure multiple projects

You can use more than one config file for a single project. Most of the apps will need a single config file for the project.

Setting the development environment to use multiple config files based on the build type or target.

Support multiple environment

By default, Apptics will load the apptics-config.plist file bundled with your application. If your development and production environments are configured as separate target/build in Xcode then you should do the following:

  • Download both config files.
  • Store the config files in different directories.
  • Rename the config files by adding a unique prefix or sufix.
  • Add both config files to your Xcode project.
  • Associate the different files with the required targets using the Target membership panel.

If the builds are part of a single target, rename the file, and add prefix or suffix (e.g. apptics-config-debug.plist and apptics-config-release.plist). Pass the file path to our run and post-install scripts.

  • To integrate Apptics in your AppExtensions please refer to this link.

Import

Copied#import <Apptics/Apptics.h>
Copied import Apptics

Configuration

  • Check the configurations and make the necessary changes, if needed. In your Appdelegate class make sure you call this method Apptics.initializewithVerbose: or Apptics.initializewithVerbose: config:` in your app applicationDidFinishLaunching:.
Note: For Mac applications, make sure you call Apptics.initializewithVerbose: in applicationWillFinishLaunching:.
Copied- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions
  [Apptics initializeWithVerbose:<#(BOOL)#>];
  return true;
}
Copiedfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {  
    Apptics.initialize(withVerbose: <#T##Bool#>)
    return true
}
  • Once you call the above methods, the SDK will start collecting data and it will be sent to Apptics server based on the network availability.
  • Please note that trackOnByDefault will govern anonymous tracking before user consent is collected. Later the user consent will override this preference.
  • You can enable setCompleteOff which will prevent the SDK from tracking until it is disabled by the developers programmatically. This is irrespective of the Settings.
Note: Apptics will not make any API call until the completeOff is disabled which includes device registration API. By default, the complete track-off is disabled in Apptics.
  • There are two kinds of tracking pseudo-anonymous and non-anonymous. The user consent and tracking behavior of the SDK will be decided based on anonymousType.
  • By default, pseudo-anonymous tracking will be enabled.
  • You can also use AppticsConfig class to configure or customize the behavior of Apptics SDK, it should be done before initializing Apptics. Equivalent set methods are made available in Apptics and other modules classes too.
Copied- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions
    AppticsConfig.defaultConfig.sendDataOnMobileNetworkByDefault=true;
    AppticsConfig.defaultConfig.trackOnByDefault=true;
    AppticsConfig.defaultConfig.anonymousType=APAnonymousTypePseudoAnonymous;

    [Apptics initializeWithVerbose:<#(BOOL)#>];
    return true;
}  
Copiedfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {  
    AppticsConfig.default.sendDataOnMobileNetworkByDefault=true
    AppticsConfig.default.trackOnByDefault=true
    AppticsConfig.default.anonymousType = .pseudoAnonymous

    Apptics.initialize(withVerbose: <#T##Bool#>)
    return true
}

Sample project

Check out the example to see how to integrate Apptics into your project.