OcrOverseasCloudKit, OcrCloudConfig, OcrCloudResult, OcrCloudError, and CustomConfigUI. The APIs supported by these classes are described in detail below.OcrOverseasCloudKit is the public entry class of the SDK. It uses Token mode and centralizes all OCR features.API | Capability Description |
Obtaining the OcrOverseasCloudKit Singleton | |
Releasing SDK Resources | |
Obtaining the SDK Version Number | |
Initializing the SDK | |
Obtaining SDK Metadata | |
Starting Token Mode Recognition |
+ (nonnull instancetype)sharedInstance;
OcrOverseasCloudKit.OcrOverseasCloudKit singleton instance.- (void)clearInstance;
- (NSString *)getVersion;
"4.0.2".- (void)initWithViewController:(UIViewController *)viewController;
Parameter Type | Parameter Name | Parameter Description |
UIViewController | viewController | ViewController that hosts the recognition page |
+ (NSString *)createMetaData;
sdkToken.- (void)startCloudOcr:(OcrCloudConfig *_Nonnull)cloudConfigwithSucceedBlock:(OcrCloudSucceedBlock _Nonnull)onSucceedwithFailedBlock:(OcrCloudFailedBlock _Nonnull)onFailed;
sdkToken through a success callback. The host App then uses this Token to pull the final recognition result from the server.Parameter Type | Parameter Name | Parameter Description |
cloudConfig | Token mode configuration object | |
OcrCloudSucceedBlock | onSucceed | Callback for successful capture, returning OcrCloudResult |
OcrCloudFailedBlock | onFailed | Callback for recognition failure, returning OcrCloudError |
OcrCloudConfig is the configuration object passed in when the SDK is started in Token mode.Type | Term | Description | Required |
NSString | sdkToken | Business Token, obtained by the host App from the server, used to connect the entire recognition process. | Required |
NSString | serverParamInfo | Server parameter information | Required |
customConfigUI | Custom UI configuration | No |
OcrCloudResult is the result object returned by the success callback in Token mode.Type | Term | Description |
NSString | sdkToken | Business Token used by the host App to pull final recognition results from the server. |
OcrCloudError is the error object returned by the failure callback in Token mode.Type | Term | Description |
NSString | sdkToken | Business Token (used for issue locating) |
NSInteger | errorCode | |
NSString | errorMsg | Error message description |
OcrOverseasCustomConfigUI is an optional UI configuration class passed in when the SDK is started.Type | Term | Description | Default Value |
id<OcrOverseasViewDelegate> | delegate | UI-related delegate | nil |
landscapeMode | Landscape mode configuration | OcrLandscapeModePortrait | |
BOOL | isShowTips | Display intermediate prompt or not | YES |
NSString | tipsShowText | Intermediate prompt content (up to 15 Chinese characters) | Avoid folded corners, obstructions, and poor lighting on the content to be recognized. |
UIImage | takePictureImage | Capture button icon, 80×80 | Default icon |
UIImage | lightONImage | Flashlight on button icon, 40×40 | Default icon |
UIImage | lightOFFImage | Flashlight off button icon, 40×40 | Default icon |
UIImage | albumImage | Album button icon, 40×40 | Default icon |
BOOL | isShowLight | Display flashlight button or not | YES |
languageType | Set current language. | OCR_DEFAULT | |
BOOL | openClipImage | Enable album image cropping page. | YES |
BOOL | supportOnlyAlbumMode | Support album-only mode when camera permission is unavailable. | NO |
BOOL | isShowPrivacyAgreementDialog | Display privacy agreement dialog or not | YES |
BOOL | isForbidAnima | Hide OCR transition animation for opening/exiting. | YES |
CGFloat | cardFrameWidth | Width of the four corner borders of the recognition frame | 2.0 |
BOOL | showBestImgConfirmDialog | Best frame confirmation dialog (OCR_DETECT_AUTO mode only) | NO |
NSArray<UIColor *> | custRectColorArr | Recognition frame color array [normal, error, pass] | nil |
NSArray<UIColor *> | custTipsColorArr | Tip color array [normal, error, pass] | nil |
UIFont | custTipsFont | Custom tip font | nil |
NSString | ocrSDKBundlePath | OcrSDK.bundle file path, read from the main bundle by default | nil |
NSString | ocrModelPath | OcrModel.bundle file path, read from the main bundle by default. | nil |
NSString | custBundlePath | Custom UI bundle path | nil |
NSString | custLanguageBundlePath | Custom multilingual bundle path | nil |
NSString | custLanguageFile | Custom language file name (such as en.lproj) | nil |
CGFloat | custRectScaleY | Y-axis offset percentage of the recognition frame, effective only in portrait mode. | 0.21 |
CGFloat | custRectScaleX | X-axis offset percentage of the recognition frame | 0.01 |
OcrLandscapeMode enum lists the supported landscape modes:Type | Description | Scenario |
OcrLandscapeModePortrait | Portrait (default) | Recognition in portrait scenarios |
OcrLandscapeModeUIRotateLandscapeLeft | UI rotated landscape - front camera on the left | The project supports only portrait mode, and landscape is achieved by rotating the page. |
OcrLandscapeModeUIRotateLandscapeRight | UI rotated landscape - front camera on the right | The project supports only portrait mode, and landscape is achieved by rotating the page. |
OcrLandscapeModeDeviceLandscapeLeft | Device rotated landscape - front camera on the left | The project supports landscape mode, and the device has a fixed rotation direction. |
OcrLandscapeModeDeviceLandscapeRight | Device rotated landscape - front camera on the right | The project supports landscape mode, and the device has a fixed rotation direction. |
OcrLanguageType enum lists the language settings:Type | Description |
OCR_DEFAULT | Follow system |
OCR_ZH_HANS | Simplified Chinese |
OCR_ZH_HANT | Traditional Chinese |
OCR_EN | English |
OCR_CUSTOMIZE_LANGUAGE | Custom language |
OCR_INDONESIA | Indonesian |
OcrCloudError.errorCode error code description:Error Code | Description |
100100 | Parameter exception |
100102 | Network exception. |
100103 | Camera permission exception. |
101000 | Recognition failed. |
200101 | The user actively cancels the recognition. |
300101 | Model initialization failed. |
300102 | Server response parsing exception. |
300103 | API signature failed. |
300104 | Camera exception. |
300105 | SDK initialization configuration failed. |
300106 | Image data is empty. |
300107 | Authorization failed. |
300108 | System version is too low (lower than iOS 11.0). |
300109 | Automatic mode timeout. |
300110 | SDK internal error. |
300112 | Document type mismatch. |
300113 | Excessive consecutive recognition failures. |
300114 | Video recording failed. |
300115 | The application was switched during the recognition process. |
400100 | Alarm Code for triggering specified interception. |
400101 | The document type provided by the user does not match the specified document type. |
400102 | The document side provided by the user does not match the selected side. |
400103 | The document occupies too small a proportion of the photo provided by the user. |
400104 | The photo provided by the user contains multiple document photos. |
400105 | OCR recognition failure. |
400106 | Document information verification failure. |
400107 | Input parameter error. |
400108 | Internal service error. |
400109 | Service not activated / Account overdue payment / Resource bundle exhausted / Billing exception. |
400110 | Rate limiting triggered. |
400111 | File size too large or invalid. |
400112 | File parsing failure. |
/// Success callback for Token mode/// @param result The success result, which contains the sdkToken.typedef void (^OcrCloudSucceedBlock)(OcrCloudResult *_Nonnull result);/// Failure callback for Token mode/// @param error The failure information, which contains the sdkToken, errorCode, and errorMsg.typedef void (^OcrCloudFailedBlock)(OcrCloudError *_Nonnull error);
sdkToken. The final recognition result must be pulled by the host App server from Tencent Cloud OCR using the sdkToken.errorCode is 200101.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback