iOS
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
- Make sure that the CocoaPods package manager is installed on your computer
- 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
- Edit the Podfile as follows:
platform :ios, '9.0'
target 'YourProjectTarget' do
pod 'TDStrategy'
end
- 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.
- 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 Name | Description | Version requirement |
|---|---|---|
| ThinkingSDK | Collects and processes data | >= 3.1.0 |
| TDRemoteConfig | Fetches configuration from the AE backend | >= 1.0.0 |
| ThinkingDataCore | Provides basic components | >= 1.1.0 |
| TDStrategy | Provides client-side triggering | >=1.0.0 |
- Click the download link at the top of this page to download the SDK, and then unzip it
- Drag
ThinkingSDK.xcframework,ThinkingDataCore.xcframework,TDStrategy.xcframework, andTDRemoteConfig.xcframeworkinto your Xcode Project Workspace - Find Targets, and add
-ObjCto theOther linker flagsoption 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 name | Type | Description |
|---|---|---|
| channelMsgType | NSString | Channel message type |
| appId | NSString | The app id of your AE project |
| pushId | NSString | Channel send ID of the operation task |
| taskId | NSString | ID of the operation task |
| content | NSDictionary | Push content of the operation task |
| userParams | NSDictionary | Custom parameters in the client channel |
| opsProperties | NSDictionary | Channel information carried by the client-triggered task, used as receipt parameters for touch funnel events. |

