Skip to main content

iOS

Last updated 10/03/2026
tip

The iOS SDK requires iOS 9.0 or later

Latest version: v1.4.1

Update time: 2026-05-12

Downloads: Download

1. Overview​

Starting from AE 4.4, the Engage module provides the client-triggered task feature, which supports millisecond-level triggering in in-app scenarios such as new user registration and character creation, as well as real-time A/B splitting. On the client side, the ThinkingData SDK communicates with the AE backend to fetch and evaluate tasks.

Integrate the ThinkingData SDK into your app. On the app side, you only need to handle interactions with the ThinkingData SDK and don't need to care about task details in the AE backend.

2. Integration​

2.1 Integrate the SDK automatically​

  1. Make sure that the CocoaPods package manager is installed on your computer
  2. If your project doesn't have a Podfile, run the following command from the command line in the same directory as the project file (.xcodeproj):
pod init
  1. Edit the Podfile as follows:
platform :ios, '9.0'
target 'YourProjectTarget' do
pod 'TDStrategy'
end
  1. In the root directory of the project, run the installation command
pod install

After the installation succeeds, the terminal shows the following output:

Analyzing dependencies
Downloading dependencies
Installing TDRemoteConfig (x.x.x)
Installing TDStrategy (x.x.x)
Installing ThinkingDataCore (x.x.x)
Installing ThinkingSDK (x.x.x)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.
  1. After the import succeeds, open the project

After the command runs successfully, a .xcworkspace file is generated, which means that you have imported the iOS SDK. Open the .xcworkspace file to open the project (note: don't open the .xcodeproj file at the same time)

2.2 Integrate the SDK manually​

Client-triggered tasks depend on the following ThinkingData SDKs:

SDK NameDescriptionVersion requirement
ThinkingSDKCollects and processes data>= 3.1.0
TDRemoteConfigFetches configuration from the AE backend>= 1.0.0
ThinkingDataCoreProvides basic components>= 1.1.0
TDStrategyProvides client-side triggering>=1.0.0
  1. Click the download link at the top of this page to download the SDK, and then unzip it
  2. Drag ThinkingSDK.xcframework, ThinkingDataCore.xcframework, TDStrategy.xcframework, and TDRemoteConfig.xcframework into your Xcode Project Workspace
  3. Find Targets, and add -ObjC to the Other linker flags option in the Build Settings menu

3. Initialization​

Initialize the SDK on the main thread

#import <ThinkingDataCore/ThinkingDataCore.h>

// SDK needs to be initialized on the main thread
// For details on how to use the TDSettings, please refer to the [Advanced] Guide.
TDSettings *settings = [[TDSettings alloc] init];
settings.mode = TDSDKModeNomal;
settings.appId = @"APPID";
settings.serverUrl = @"SERVER_URL";
[TDApp startWithSetting:settings];

4. Set a delegate​

After the SDK is initialized, set a delegate for the TDStrategy SDK.

#import <TDStrategy/TDStrategy.h>

// your code ...

[TDStrategy setTriggerDelegate:self];

4.1 Delegate protocol​

The protocol constrains the implementation of the delegate class. When an operation task is triggered, the callback method in the delegate class is called.

#import <Foundation/Foundation.h>
@class TDStrategyResult;

@protocol TDStrategyTriggerDelegate <NSObject>

@optional
- (void)tdStrategyDidTrigger:(TDStrategyResult *)result;

@end

4.2 Callback data model​

@interface TDStrategyResult : NSObject
@property (nonatomic, copy) NSString *channelMsgType;
@property (nonatomic, copy) NSString *appId;
@property (nonatomic, copy) NSString *pushId;
@property (nonatomic, copy) NSString *taskId;
@property (nonatomic, strong, nullable) NSDictionary *content;
@property (nonatomic, strong, nullable) NSDictionary *userParams;
@property (nonatomic, strong, nonnull) NSDictionary *opsProperties;
@end

Property description

Property nameTypeDescription
channelMsgTypeNSStringChannel message type
appIdNSStringThe app id of your AE project
pushIdNSStringChannel send ID of the operation task
taskIdNSStringID of the operation task
contentNSDictionaryPush content of the operation task
userParamsNSDictionaryCustom parameters in the client channel
opsPropertiesNSDictionaryChannel information carried by the client-triggered task, used as receipt parameters for touch funnel events.
Was this page helpful?