Disabling Automatic SDK Initialization

If you prefer to control when the SDK starts, you can disable the autostart feature and programmatically start the SDK when needed.

The first step is to add the required key to your Info.plist. The key is CSDisableAutostart of type boolean. To disable the autostart, you need to set its value to true:

  • Disable autostart using Xcode:

  • Disable autostart using a text editor:

    Info.plist
    <key>CSDisableAutostart</key>
    <true/>

Then call start() in the application:didFinishLaunchingWithOptions: of your UIApplicationDelegate:

import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Contentsquare.start()
return true
}
// ...
}

When you call the start method, the SDK automatically starts tracking users’ interactions with the app (gestures, lifecycle events and crashes).