iOS

Requirement

Environment

ItemsDescription
Supported System VersionsiOS 9.0 and above
Supported Architecturesarmv7, arm64, x86_64

Integration

Install(CocoaPods)

  • Add pod 'TrustDecisionPro', '5.2.4.1' to the target in the Podfile
  • Add pod 'TrustDecisionAPISign', '1.1.1' 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 execute arch -x86_64 pod install --repo-updatecommand)

Import Header File

Include the header file at the location where it is called.

#import <TDMobRisk/TDMobRisk.h>
import TDMobRisk

Interface Signature

API Definition

TDAPISignResult (*sign)(NSString *path);

Struct Definition

typedef struct _TDAPISignResult{
    // Signature result
    const char* sign;
    // Status code
    int code;
    // Error message
    const char* msg;
}TDAPISignResult;

Best Practices

The API to be protected is in the following form: https://sg.apitd.net/de/v1

NSString *path = @"de/v1";
TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
TDAPISignResult result = manager->sign(path);
// Sign Success
if(result.code == 0){
    // Get signature
    NSString* signString = [NSString stringWithUTF8String:result.sign];
}else{
    // Get status code
    int code = result.code;
    // Get error message
    NSString* errMsgString = [NSString stringWithUTF8String:result.msg];
    // Continuing with the business logic, the application here can handle exceptions based on the business logic.
}
let body = "sdsdsdsds...ihhfywehnas"
let path = "de/v1"
let manager = TDMobRiskManager.sharedManager()
let result = manager?.pointee.signWithBody(path,body)
// Sign Success
if result?.code == 0 {
    // Get signature
    let signString = result?.sign
}else {
    // Get status code
    let code = result?.code
    // Get error message
    let errMsgString = result?.msg;
    // Continuing with the business logic, the application here can handle exceptions based on the business logic
}

Status Check

The determination is made based on the status code returned by the signature.

TDAPISignResult.code==0

Status Code

CodeMessageRemarks
0Success/
2000Path is emptyPlease set the path parameter.
22xxInternal errorPlease contact technical support.
3001Internal errorPlease contact technical support.
3002Internal errorPlease contact technical support.
3003Internal errorPlease contact technical support.
3004Internal errorPlease contact technical support.