iOS
Resources and Overview
The GeeTest iOS SDK is provided to developers who are integrating it into iOS native client development. The SDK does not rely on any third-party libraries.
Environment and Requirements
Item | Resources |
---|---|
Development object | Compatible with iOS 9+ |
Development environment | Xcode 13.0+ |
System Dependenies | None |
SDK Third-Party Dependencies | None |
Installation
Get the SDK
Please contact your account manager to get SDK
Import SDK
If you are manually adding the SDK, drag the downloaded
GeeGuardSDK.frameworkfile
into your project, ensuring thatCopy items if needed
is selected.Please import the
framework
using theLinked Frameworks
and Libraries method. After draggingGeeGuardSDK.framework
into the project, also check if the.framework
is added toPROJECT -> Build Phases -> Linked Frameworks and Libraries
.In addition, there are SDKs in XCFramework format located in the SDK/XCFramework directory.
It is recommended to add
Access WiFi Information
in thePROJECT -> Target -> Capabilities
section of your project.After successfully adding it, Xcode will automatically create the entitlement.
The iOS SDK for device fingerprinting utilizes certain functions to obtain disk capacity and environmental detection information for risk control purposes, involving the categories
NSPrivacyAccessedAPICategoryDiskSpace
andNSPrivacyAccessedAPICategoryFileTimestamp
.Apple has announced a new privacy policy for applications (including SDK) at WWDC23, and there is a separate session on this topic titled Get started with privacy manifests - WWDC23 - Videos - Apple Developer. On July 27th, Apple released a news article stating that starting in the fall of 2023, if a newly uploaded application uses relevant APIs that do not provide a privacy manifest, you will receive an email notification. Starting in the spring of 2024, privacy manifests will become a mandatory requirement. The APIs involved and the reasons for their use can be found in Describing use of required reason API | Apple Developer Documentation. If the reason for use is not listed, you can directly submit the specific usage reason. For instructions on how to create a new privacy manifest, please refer to Privacy manifest files | Apple Developer Documentation.
The call logic
- Register and obtain an AppID on the dashboard
- Use the AppID to obtain GeeID or GeeToken
For code integration, please refer to the sample code below
Compile and run your project
Complie your project and experience GeeGuard !
Sample code
Access applicable to version 2.3.0 and above
Import Header Files
Import the header files for the verification dynamic library GeeGuardSDK.framework
in your project.#import <GeeGuardSDK/GeeGuardSDK.h>
Create the appID on the GeeTest dashboard immediately after the application starts
// Please use the appID generated from the dashboard. |
Get GeeToken
Sign the data by using the GeeGuardSDK and obtain the environmental detection GeeToken.// Get GeeToken directly, requires parsing the result on the server side
- (void)getGeeToken {
NSData *data = [@"The sole mark of the data or transaction for this business serial number, for the purpose of business correlation and validation." dataUsingEncoding:NSUTF8StringEncoding];
GeeGuardReceipt *receipt = [GeeGuard fetchReceiptWithSignData:data];
if (receipt) {
//Submit along with business data, please obtain the final environmental identification result and fingerprint on the server side.
// Please refer to the server-side documentation for the API parameters.
NSLog(@"GeeToken: %@", receipt.geeToken);
}
else {
NSLog(@"Unable to obtain GeeGuardReceipt,please check if you have registered the AppID through [[GeeGuard sharedGuard] registerWithAppID:]");
}
}
// Get the respondedGeeToken, which needs to be parsed on the server-side.
// This method callback is asynchronous.
- (void)getRespondedGeeToken {
NSData *data = [@"Uniquely marks the data or proof for this business serial number, used for business correlation and verification." dataUsingEncoding:NSUTF8StringEncoding];
[GeeGuard submitReceiptWithSignData:data completion:^(GeeGuardReceipt * _Nullable receipt, NSError * _Nullable error) {
if (!error) {
//Submit along with business data, please obtain the final environmental identification result and fingerprint on the server side.
// Please refer to the server-side documentation for the API parameters
NSLog(@"RespondedGeeToken: %@", receipt.respondedGeeToken);
}
else {
NSLog(@"error code: %ld", error.code);
NSLog(@"error: %@", error.userInfo.description);
}
}];
}
Error Code
The possible error codes that may be returned in the asynchronous retrieval method submitReceiptWithSignData:completion:
include:
Error code | Description |
---|---|
-200 | Unregistered AppID, please regisger an AppID after starting. |
-300 | Network error, please refer to the information in the userInfo of the error object for details |
-500 | Service response format is abnormal, please check receipt.originalResponse for details. |
-501 | Service response failure, please check receipt.originalResponse for details. |
Querying GeeToken Result
Submit respondedGeeToken or GeeToken along with business data to the business server, which will then query the result from the GeeTest Device Fingerprinting Service. For more details, refer to the server-side documentation.