# Integrated Requirement

# Compliance Explanation

Please note that when integrating SDK products provided by the TrustDecision in the APP of your company:

1.1 According to the user's information protection regulations, before your users start the App for the first time and start collecting information, your company should fully inform the user of the purpose, method, and scope of collecting, using, and sharing the user's personal information with a third party through an interactive interface or design (such as a pop-up window of the privacy policy), and obtain the express consent of the end user.

1.2 To provide business security and risk control services to your company, the TrustDecision SDK will collect, process, and use the identification information(IMEI/IDFA), AndroidID, IMSI, MEID, MAC address, SIM card serial number, device type, device model, system type, geographical location, login IP address, application list, running process, sensor information(light sensor, gravity sensor, magnetic field sensor, acceleration sensor, gyroscope sensor) and other device information of the user's device. To ensure compliance with your use of related services, the aforementioned privacy policy should cover the authorization of TrustDecision SDK to provide services and collect, process, and use relevant information. The following terms are for your reference. The specific expression can be determined by your company according to the overall framework and content of your privacy agreement:

TrustDecision SDK: For business security and risk control, our company uses the TrustDecision SDK. The SDK needs to obtain the information of your devices, such as (IMEI/IDFA), AndroidID, IMSI, MAC address, SIM card serial number, device type, device model, system type, geographic location, login IP address, application list, running process, sensor information(light sensor, gravity sensor, magnetic field sensor, acceleration sensor, gyroscope sensor) and other related device information, for fraud risk identification.

Privacy Protocol: https://www.trustdecision.com/legal/privacy-policy (opens new window)

# Environment

Items Description
Supported System Versions iOS9.0+
Supporting architecture armv7, arm64, x86_64

# Integrate Steps

# CocoaPods

  • Added pod 'TrustDecisionPro', '4.2.4.2' in the corresponding target in the Podfile
  • Execute the pod install --repo-update command in the folder where the Podfile is located. (M1 series mac computers need to execute arch -x86_64 pod install --repo-update command)

# SDK Structure

files in Pods/TrustDecisionPro directory:

  • TDMobRisk.framework(TrustDecision SDK, is a static library type)
  • TDCorePlugin.framework (TrustDecision plugin, is an Embed dynamic library type)

# Import Header File

Please import the header file if you want to call SDK API. Objective C

#import <TDMobRisk/TDMobRisk.h>

Swift

import TDMobRisk

# Initialization

Precautions

When the installation starts for the first time, the SDK initialization is performed after the user agrees with the privacy agreement. Avoid SDK initialization collection without the user agreeing to the privacy agreement, causing compliance risk accidents.

# Interface Definition

void (*initWithOptions)(NSDictionary *options);

Sample Code Objective C

- (void)initTrustDecisionSDK:(void (^)(NSString *blackbox))callback {
  // Get riskManager
  TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
  // Initialization Configuration
  NSMutableDictionary *options = [NSMutableDictionary dictionary];

/*************************** Mandatory Parameter ***************************/
  //Partner code, Refer to `Required Configuration`
  [options setValue:@"[Your partner]" forKey:@"partner"];
  //App key, Refer to `Required Configuration`
  [options setValue:@"[Your appKey]" forKey:@"appKey"];
  //App name, Refer to `Required Configuration`
  [options setValue:@"[Your appName]" forKey:@"appName"];
  //Country code, Refer to `Required Configuration`
  [options setValue:@"[Your country code]" forKey:@"country"];

/*************************** Optional Parameter ***************************/
#ifdef DEBUG
  // !!! If not set this parameter in DEBUG mode, the app will terminate
  [options setValue:@"allowed" forKey:@"allowed"];
#endif
  [options setValue:^(NSString *blackbox) {
  // The callback here is in the sub-thread
  // Under normal network conditions, the results will be returned within 200-300ms.
  // If the network is abnormal, it will return after the timeout timeLimit (default: 15s).
    if (callback) {
        callback(blackbox);
    }
  } forKey:@"callback"];
  riskManager->initWithOptions(options);
}

Swift

func initTrustDecisionSDK(callback: @escaping (_ blackBox:String) -> Void) {
  let riskManager = TDMobRiskManager.sharedManager()
  var options = [String : NSObject]()
  /*************************** Mandatory Parameter ***************************/
  // Partner code, Refer to `Required Configuration`
  options.updateValue("[Your partner]" as NSObject, forKey: "partner")
  // App key, Refer to `Required Configuration`
  options.updateValue("[Your appKey]" as NSObject, forKey: "appKey")
  // App name, Refer to `Required Configuration`
  options.updateValue("[Your appName]" as NSObject, forKey: "appName")
  // Country code, Refer to `Required Configuration`
  options.updateValue("[Your country]" as NSObject, forKey: "country")

   /*************************** Optional Parameter ***************************/
#if DEBUG
  // !!! If not set this parameter in DEBUG mode, the app will terminate
  options.updateValue("allowed" as NSObject, forKey: "allowed")
#endif

  let tdcallback: (String)-> Void = {blackBox in
  // The callback here is in the sub-thread
  // Under normal network conditions, the results will be returned within 200-300ms.
  // If the network is abnormal, it will return after the timeout timeLimit (default: 15s).
    callback(blackBox)
 }
 options["callback"] = unsafeBitCast(tdcallback as @convention(block) (String)
-> Void, to: AnyObject.self) as? NSObject
 riskManager?.pointee.initWithOptions(options)
}

Required Configuration

Key Definition Description Scene Sample code
partner Partner code Partner, please contact TrustDecision to obtain All Scenes Objective C [options setValue:@"[Your partner]" forKey:@"partner"]; Swift options.updateValue("[Your partner]" as NSObject, forKey: "partner")
appKey App key Appkey, please offer your App bundleId for TrustDecision to obtain appkey creation requires the user to provide the application bundleId. ⚠️ Different values for bundleId are used for different applications All Scenes Objective C [options setValue:@"[Your appKey]" forKey:@"appKey"]; Swift options.updateValue("[Your appKey]" as NSObject, forKey: "appKey")
appName App name AppName, please contact TrustDecision to obtain All Scenes Objective C [options setValue:@"[Your appName]" forKey:@"appName"]; Swift options.updateValue("[Your appName]" as NSObject, forKey: "appName")
country Country code Country/region parameters, such as cn sg us fra Fill in the corresponding parameters according to country and region of business. cn means China, sg means Singapore, us means North America, fra means Europe Objective C [options setValue:@"[Your country code]" forKey:@"country"]; Swift options.updateValue("[Your country code]" as NSObject, forKey: "country")

# Get SDK Version

Sample Code

Objective C

// Get SDKVersion
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
NSString *sdkVersion = riskManager->getSDKVersion();

Swift

// Get SDKVersion
let riskManager = TDMobRiskManager.sharedManager()
let sdkVersion = riskManager?.pointee.getSDKVersion()

# Fingerprint

# initWithOptions Optional Parameter

Key Definition Description Scene Sample code
allowed Anti-debugging configuration After the SDK is integrated, the app has the anti-debugging function by default. If you don't want this feature, please set allowed to disable it. Develop: Please set this configuration. Release: Please remove this configuration. Objective C [options setValue:@"allowed" forKey:@"allowed"]; Swift options.updateValue("allowed" as NSObject, forKey: "allowed")
timeLimit SDK timeout interval Configuration (unit: seconds) Timeout interval of network request callback after SDK initialization. Default is 15s. If you have certain requirements for the callback time of the SDK, please set timeLimit. Objective C [options setValue:@"5" forKey:@"timeLimit"]; Swift options.updateValue("5" as NSObject, forKey: "timeLimit")
noLocation SDK location information collection configuration SDK collects location if the app has been authorized to get location information. If you don't want SDK to collect location information, please set noLocation. Objective C [options setValue:@"noLocation" forKey:@"noLocation"]; Swift options.updateValue("noLocation" as NSObject, forKey: "noLocation")
noIDFA SDK Advertising Identifier (IDFA) collection configuration SDK collects IDFA if the app has been authorized to get IDFA information. If you don't want SDK to collect IDFA information and contain IDFA-related code, please set noIDFA. Objective C [options setValue:@"noIDFA" forKey:@"noIDFA"]; Swift options.updateValue("noIDFA" as NSObject, forKey: "noIDFA")
noDeviceName SDK deviceName collection configuration SDK collects deviceName if the app has been authorized to get deviceName information. If you don't want SDK to collect deviceName information, please set noDeviceName. Objective C [options setValue:@"noDeviceName" forKey:@"noDeviceName"]; Swift options.updateValue("noDeviceName" as NSObject, forKey: "noDeviceName")
callback SDK asynchronous callback configuration After the SDK uploads and collects data, it returns the blackbox according to the network request results. Success: Return non-degraded blackbox. Failed: Return degraded blackbox. If you want to get a non-degraded blackbox as much as possible, please set a callback to get blackbox. Objective C [options setValue:^(NSString *blackbox) {} forKey:@"callback"]; Swift let callback: (String)-> Void = {blackBox in } options["callback"] = unsafeBitCast(callback as @convention(block) (String) -> Void, to: AnyObject.self) as? NSObject
collectLevel Degraded blackbox length configuration Degraded blackbox will be longer. This configuration allows you to control the length of the degraded blackbox If you wish the degraded blackbox length is as short as possible, please set this configuration. Objective C [options setValue:@"M" forKey:@"collectLevel"]; Swift options.updateValue("M" as NSObject, forKey: "collectLevel")

# Get Blackbox

Attention

  • Please getBlackBox after initWithOptions, otherwise SDK exceptions will be caused.
  • We suggest that developers do not cache the results returned by getBlackBox in the app. Please rely on this function to get blackbox.

Sample Code

Objective C

// Get BlackBox
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
NSString *blackbox = riskManager->getBlackBox();

Swift

// Get BlackBox
let riskManager = TDMobRiskManager.sharedManager()
let blackBox = riskManager?.pointee.getBlackBox()

# FAQ

Q1:After Integrating the TrustDecision SDK, the project cannot be debugged in Xcode. How to solve it?

A1:Please refer to Initialization (opens new window) When the TrustDecision SDK is initialized, add the following parameters

Objective C

[options setValue:@"allowed" forKey:@"allowed"];

Swift

options.updateValue("allowed" as NSObject, forKey: "allowed")
: 2023/06/07 16:19:48