Requirement
Compliance
Please note that when integrating SDK products provided by 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 IDFA, AndroidID, OAID, MAC address, Wireless IP address, WIFI list, wireless router identification (BSSID, SSID),device type, device model, system type, geographical location(Rough location information, precise location information), login IP address 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 IDFA, AndroidID, OAID, GAID,MAC address, Wireless IP address, WIFI list, wireless router identification (BSSID, SSID),device type, device model, system type, geographical location(Rough location information, precise location information), login IP address, application list, running process, network type,device software version,sensor information(light sensor, gravity sensor, magnetic field sensor, acceleration sensor, gyroscope sensor) and other related device information, for fraud risk identification. |
Privacy Policy: https://www.trustdecision.com/legal/privacy-policy
Environment
Items | Description |
---|---|
Supported System Versions | iOS 9.0 and above |
Supported Architectures | armv7, arm64, x86_64 |
Integrate
integrate sample : https://github.com/trustdecision/mobrisk-ios-sample
Install
If installing offline, please refer to Offline Install
Structure
- TDMobRisk.xcframework(TrustDecision SDK, is a static library)
- TDCorePlugin.xcframework (TrustDecision plugin, is an Embed dynamic library)
- FMDeviceManagerFramework.xcframework (DeviceFingerprint SDK, is a static library)
Install(CocoaPods)
- Add
pod 'TrustDecisionPro', '4.3.1.2'
to the target in the Podfile - Execute the
pod install --repo-update
command in the folder where the Podfile is located. (M series mac computers need to executearch -x86_64 pod install --repo-update
command)
Import Header File
#import <TDMobRisk/TDMobRisk.h>
import TDMobRisk
App Privacy Configuration
According to the latest App Store Privacy Policy announced by Apple, starting from the spring of 2024, apps listed on the App Store will need to carry an App privacy list document.
Starting May 1, 2024, App Store Connect will not accept apps that do not describe their use of the required reason API in a privacy manifest file.
Adaptation Steps
Please choose a solution based on your actual situation.
- If the PrivacyInfo.xcprivacy file does not exist in the project directory
- Create a new App Privacy type file through Xcode in the project directory, name it PrivacyInfo, and check the required Targets
- Select the PrivacyInfo.xcprivacy file in the project directory and right-click to open the menu. Open the file through Open As -> Source Code in the menu
- Paste the SDK's PrivacyInfo.xcprivacy below into the PrivacyInfo.xcprivacy file in the project directory
- If the PrivacyInfo.xcprivacy file already exists in the project directory
- Select the PrivacyInfo.xcprivacy file in the project directory and right-click to open the menu. Open the file through Open As -> Source Code in the menu.
- Added content in the PrivacyInfo.xcprivacy file in the project directory that is mentioned in SDK's PrivacyInfo.xcprivacy but is still missing in the project directory PrivacyInfo.xcprivacy file
SDK's PrivacyInfo.xcprivacy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
</dict>
</plist>
Initialization
Cautions
- Ensure that it is initialized after the user agrees to the privacy agreement.
Definition
void (*initWithOptions)(NSDictionary *options);
Get blackBox
Cautions
- Call
getBlackBox
orgetBlackBoxAsync
afterinitWithOptions
. - Don't cache blackBox returned by getBlackBox in the app. Please rely on this function to get blackBox.
Definition
/* Get blackBox asynchronously */
void (*getBlackBoxAsync)(TDGetBlackBoxAsyncBlock block);
/* Get blackBox synchronously */
NSString (*getBlackBox)(void);
Best Practices
- Call initialization at entry of the application
- (void)initTrustDecisionSDK {
// Get riskManager
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
// Initialization Configuration
NSMutableDictionary *options = [NSMutableDictionary dictionary];
/*************************** Required ***************************/
// get from our customer platform`
[options setValue:@"[Your partner]" forKey:@"partner"];
// get from our customer platform
[options setValue:@"[Your appKey]" forKey:@"appKey"];
//Country code, Refer to `All configuration`
[options setValue:@"[Your country code]" forKey:@"country"];
/*************************** Optional ***************************/
#ifdef DEBUG
// !!! If not set this parameter in DEBUG mode, the app will terminate
[options setValue:@(YES) forKey:@"allowed"];
// Listen for error codes
riskManager->setOnErrorCodeListener(^(int errorCode,const char* errorMsg){
NSLog(@":errorCode:%d,errorMsg:%s",errorCode,errorMsg);
});
#endif
riskManager->initWithOptions(options);
}
func initTrustDecisionSDK() {
let riskManager = TDMobRiskManager.sharedManager()
var options = Dictionary<String, Any>()
/*************************** Mandatory Parameter ***************************/
// Partner code, Refer to `Required Configuration`
options.updateValue("[Your partner]" , forKey: "partner")
// App key, Refer to `Required Configuration`
options.updateValue("[Your appKey]" , forKey: "appKey")
// Country code, Refer to `Required Configuration`
options.updateValue("[Your country]" , forKey: "country")
/*************************** Optional Parameter ***************************/
#if DEBUG
// !!! If not set this parameter in DEBUG mode, the app will terminate
options.updateValue(true, forKey: "allowed")
// Listen for error codes
riskManager?.pointee.setOnErrorCodeListener(){(errorCode : Int32!,errorMsg : UnsafePointer<CChar>!)->Void in
print("errorCode: \(errorCode), errorMsg: \(String(validatingUTF8: errorMsg))")
};
#endif
// !!!The callback method has been removed, and now a getBlackBoxAsync method has been added to asynchronously obtain blackBox
riskManager?.pointee.initWithOptions(options)
}
- Obtain blackBox in actual business scenarios
- Recommend using asynchronous methods to obtain without affecting the calling thread.
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager]; riskManager->getBlackBoxAsync(^(NSString* blackBox){ NSLog(@"blackBox:%@",blackBox); });
let riskManager = TDMobRiskManager.sharedManager() riskManager?.pointee.getBlackBoxAsync(){(blackBox : String!)->Void in print("blackBox:" + blackBox) }
- If the blackBox has been successfully obtained through asynchronous method before, it can be directly obtained through synchronous method.
// May be time-consuming, be cautious when calling in the main thread TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager]; NSString *blackBox = riskManager->getBlackBox();
// May be time-consuming, be cautious when calling in the main thread let riskManager = TDMobRiskManager.sharedManager() let blackBox = riskManager?.pointee.getBlackBox()
- Recommend using asynchronous methods to obtain without affecting the calling thread.
Status Check
- getBlackBox() will return a 26-bit string while initialization successfully, like
rGPGX1678775227I9NCwcuVJCb
. - getBlackBox() will return a string of around 5000 bits while initialization Failed, please refer to overview-definition
Other
Get SDK Version
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
NSString *sdkVersion = riskManager->getSDKVersion();
let riskManager = TDMobRiskManager.sharedManager()
let sdkVersion = riskManager?.pointee.getSDKVersion()
Error Listen
Please call setOnErrorCodeListener before the initWithOptions method to listen for error messages. It is recommended to use it only in debug mode.
TDMobRiskManager_t *riskManager = [TDMobRiskManager sharedManager];
riskManager->setOnErrorCodeListener(^(int errorCode,const char* errorMsg){
NSLog(@":errorCode:%d,errorMsg:%s",errorCode,errorMsg);
});
let riskManager = TDMobRiskManager.sharedManager()
riskManager?.pointee.setOnErrorCodeListener(){(errorCode : Int32,errorMsg : UnsafePointer<CChar>?)->Void in
print("errorCode:" + errorCode + "," + "errorMsg:" + errorMsg);
}
All Configurations
Key | Description | Sample | Remove Field |
---|---|---|---|
partner(required) | Partner code, contact operator to obtain. | Objective C [options setValue:@"your partner" forKey:@"partner"]; Swift options.updateValue("your partner" , forKey: "partner") | |
appKey(required) | Application identification, please refer tohow to get appKey | Objective C [options setValue:@"your appKey" forKey:@"appKey"]; Swift options.updateValue("your appKey" , forKey: "appKey") | |
country(required) | Data-center: cn for China fra for Europe sg for Singapore inda for Indonesia us for the USA | Objective C [options setValue:@"cn" forKey:@"country"]; Swift options.updateValue("cn" , forKey: "country") | |
allowed | Allow debugging, default false, must be closed before the application release. | Objective C [options setValue:@(YES) forKey:@"allowed"]; Swift options.updateValue(true, forKey: "allowed") | |
appName | Application name, contact operator to obtain | Objective C [options setValue:@"your appName" forKey:@"appName"]; Swift options.updateValue("your appName", forKey: "appName") | |
channel | Channel, contact operator to obtain | Objective C [options setValue:@"your channel" forKey:@"channel"]; Swift options.updateValue("your channel", forKey: "channel") | |
timeLimit | Network timeout configuration, in seconds, default 15s | Objective C [options setValue:@(5) forKey:@"timeLimit"]; Swift options.updateValue(5, forKey: "timeLimit") | |
location | Whether collecting GPS location information, default allowed | Objective C [options setValue:@(YES) forKey:@"location"]; Swift options.updateValue(true, forKey: "location") | latitude、longitude、gps_location |
IDFA | Whether collecting IDFA information, default allowed | Objective C [options setValue:@(YES) forKey:@"IDFA"]; Swift options.updateValue(true, forKey: "IDFA") | idfa |
deviceName | Whether collecting device name, default allowed | Objective C [options setValue:@(YES) forKey:@"deviceName"]; Swift options.updateValue(true, forKey: "deviceName") | device_name |
ssid | Whether collecting ssid, default allowed | Objective C [options setValue:@(NO) forKey:@"ssid"]; Swift options.updateValue(false, forKey: "ssid") | ssid |
USE_DEMOTION | When the current request fails, whether to use the downgraded data first, default false | Objective C [options setValue:@(YES) forKey:@"USE_DEMOTION"]; Swift options.updateValue(true, forKey: "USE_DEMOTION") | |
collectLevel | You can set M to control the maximum length of blackBox to 2000, default around 5000 | Objective C [options setValue:@"M" forKey:@"collectLevel"]; Swift options.updateValue("M", forKey: "collectLevel") | |
customMessage | Custom messages, SDK supports transparent transmission and storage | Objective C [options setValue:@"this is a customMessage" forKey:@"customMessage"]; Swift options.updateValue("this is a customMessage", forKey: "customMessage") |
Error Code
code | how to handle |
---|---|
100 | Ensure initWithOptions is called before getBlackBox or getBlackBoxAsync |
101 | Not affect usage. If you want to obtain a shorter blackBox, you can learn from the best practices mentioned above |
102 | Not affect usage. If you want to obtain a shorter blackBox, try to use getBlackBox() after a successful callback of getBlackBoxAsync |
200 | Required parameter exception, adjust according to the error message |
201 | Please get in touch with our operator to update the validity period of the appKey |
202 | Set the allowed parameter to YES while debugging |
300 | Please first check if the timeLimit configuration has set a too short time. If it still cannot be resolved, please provide the blackBox, code, and error message to the technical for assistance |
301 | Please check the network status of the current device and App first |
302 | Please first check if the appKey and partnerCode meet the document requirements. Then check if the appKey fits the bundleID. If it still cannot be resolved, please provide the blackBox, code, and error message to the technical for assistance |
-1 | Please provide the blackBox, code, and error message to the technical for assistance |