Updated on 2024-07-30 GMT+08:00

Scenario 1: Initialization

Description

The initialization API can be called for SDK initialization after a third-party application starts. You only need to call this API once. You must call this API before calling other functional APIs.

Service Process

During SDK initialization, call the initWithConfig API and then check whether the API is successfully called based on the returned value.

  1. Call the API.

    1. Build HWMOpenSDKConfig model parameters.
    2. Call the initWithConfig API to initialize the configuration. The data in the preceding step is used as input parameters.

  2. Check the returned value.

    YES: The initialization is successful. NO: The initialization fails.

Sample Code

1
2
3
4
5
6
7
/// Initialization.
HWMOpenSDKConfig *config = [[HWMOpenSDKConfig alloc] init];
config.appId = getAppId();// Enter the applied app ID.
BOOL result = [HWMSdk initWithConfig:config];
if (result) {
    NSLog(@"Initialization succeeded.");
}

The sample code in the typical scenario and API reference is pseudo code and cannot be directly used.