Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Initializing the SDK

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

There are main thread initialization and subthread initialization APIs. Call either of them before calling other APIs.

initWithConfig

API Description

This API is used to start and initialize the SDK.

Precautions

  1. You must call the initialization API before calling other APIs.
  2. The initialization method must be called in the main thread.
  3. The return value only indicates whether the API is successfully called.

Method Definition

1
+ (BOOL)initWithConfig:(HWMOpenSDKConfig *)config;

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

config

Yes

HWMOpenSDKConfig

Initialization information set.

Table 2 HWMOpenSDKConfig description

Parameter

Mandatory

Type

Description

appId

Yes

NSString *

App ID. For details about how to request an app ID, see Requesting an App ID in Developer Guide.

appGroupIndentifier

No

NSString *

App group of the screen sharing extension. If this parameter is not transferred, the screen sharing function cannot be used. This parameter is used for communication between the sharing process and the main process during screen sharing. For details, see Apple's extension documentation.

siteType

No

HWMSdkSiteType

Login site type. The default value is HWMSdkSiteTypeChina.

serverAddress

No

NSString *

Server address.

serverPort

No

NSUInteger

Server port.

hideExternalLabel

No

BOOL

Whether to hide the External label in the participant list, host role transferring screen or chat screen. By default, the External label is displayed.

logKeepDays

No

NSInteger

Log storage duration. Valid value range is 3–30. The default value is 0. 0 indicates that logs are not deleted by day.

Note: 1 and 2 will be converted to 3, and the values greater than 30 will be converted to 30.

disableIncomingLocalNotification

No

BOOL

Disables local push for incoming calls.

isSupportMultiAppLogin

No

BOOL

Whether to support login to multiple applications on the same device.

NOTE:

For details about how to request an app ID, see Requesting an App ID in Developer Guide.

Table 3 Enumerated values of HWMSdkSiteType

Enumerated Value

Description

HWMSdkSiteTypeChina

Chinese mainland.

HWMSdkSiteTypeAP

Asia Pacific.

Return Values

Table 4 Return value

Type

Description

BOOL

If the initialization succeeds, YES is returned. If the initialization fails, NO is returned.

Sample Code

1
2
3
4
5
6
7
8
/// Initialization.
HWMOpenSDKConfig *config = [[HWMOpenSDKConfig alloc] init];
config.appId = getAppId();// Enter the applied app ID.
config.appGroupIndentifier = getAppGroupIndentifier();// App group of the screen sharing extension. This parameter is mandatory and used for communication between the sharing process and the main process during screen sharing. For details, see Apple's extension documentation.
BOOL result = [HWMSdk initWithConfig:config];
if (result) {
    NSLog(@"Initialization succeeded.");
}
NOTE:
  • The sample code in the typical scenario and API reference is pseudo code and cannot be directly used.

initAsyncWithConfig:callback:

API Description

This API is used to start and initialize the SDK in a subthread.

Precautions

  1. You must call the initialization API before calling other APIs.
  2. The return value only indicates whether the API is successfully called.

Method Definition

1
+ (void)initAsyncWithConfig:(HWMOpenSDKConfig *)config callback:(_Nonnull HWMSDKInitCompleteHandler)callback;

Parameter Description

See Table 1.

Return Values

None

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/// Initialization.
HWMOpenSDKConfig *config = [[HWMOpenSDKConfig alloc] init];
config.appId =getAppId();// Enter the applied app ID.
config.appGroupIndentifier = getAppGroupIndentifier();// App group of the screen sharing extension. This parameter is mandatory and used for communication between the sharing process and the main process during screen sharing. For details, see Apple's extension documentation.
[HWMSdk initAsyncWithConfig:config callback:^(HWMSDKERR errCode, id  _Nullable result) {
    if (errCode == HWMSDKSdkerrSuccess) {
    NSLog(@"Initialization succeeded.");
    } else {
        NSLog(@"Initialization failed.");
    }
}];
NOTE:
  • The sample code in the typical scenario and API reference is pseudo code and cannot be directly used.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback