Help Center> Object Storage Service> iOS> Initialization> Configuring an Instance of OBSClient
Updated on 2024-05-08 GMT+08:00

Configuring an Instance of OBSClient

You can use the OBSServiceConfiguration configuration class to configure an instance of OBSClient, including the proxy, connection timeout period, maximum number of retry attempts, and other parameters listed in the following table.

Table 1 Parameters for configuring a network request

Parameter

Description

Recommended Value

OBSServiceConfiguration.credentialProvider

User credential. For details, see Table 2.

N/A

OBSServiceConfiguration.proxyConfig

Proxy configuration. The default value is null. For details, see Table 3.

N/A

OBSServiceConfiguration.trustUnsafeCert

Whether to trust insecure certificates. The default value is NO.

Default value

OBSServiceConfiguration.maxConcurrentCommandRequestCount

Maximum number of concurrent command requests. The default value is 3.

Default value

OBSServiceConfiguration.maxConcurrentUploadRequestCount

Maximum number of concurrent upload requests. The default value is 3.

Default value

OBSServiceConfiguration.maxConcurrentDownloadRequestCount

Maximum number of concurrent download requests. The default value is 3.

Default value

OBSServiceConfiguration.defaultDomainMode

Domain name access mode. You can set this parameter to OBSDomainModeCustom to use a user-defined domain name. By default, the non-user-defined domain name access mode is used.

Default value

OBSServiceConfiguration.commandSessionConfiguration.HTTPMaximumConnectionsPerHost

Maximum number of command request connections that can be opened. The default value in iOS is 4.

N/A

OBSServiceConfiguration.uploadSessionConfiguration.HTTPMaximumConnectionsPerHost

Maximum number of upload request connections that can be opened. The default value in iOS is 4.

N/A

OBSServiceConfiguration.downloadSessionConfiguration.HTTPMaximumConnectionsPerHost

Maximum number of download request connections that can be opened. The default value in iOS is 4.

N/A

OBSServiceConfiguration.backgroundUploadSessionConfiguration.HTTPMaximumConnectionsPerHost

Maximum number of background upload request connections that can be opened. The default value in iOS is 4.

N/A

OBSServiceConfiguration.backgroundDownloadSessionConfiguration.HTTPMaximumConnectionsPerHost

Maximum number of background download request connections that can be opened. The default value in iOS is 4.

N/A

OBSServiceConfiguration.commandSessionConfiguration.timeoutIntervalForRequest

Timeout interval for a command request, in seconds.

60

OBSServiceConfiguration.uploadSessionConfiguration.timeoutIntervalForRequest

Timeout interval for an upload request, in seconds.

60

OBSServiceConfiguration.downloadSessionConfiguration.timeoutIntervalForRequest

Timeout interval for a download request, in seconds.

60

Set parameters with N/A as the recommended value based on your needs. For security purposes, you are advised to use HTTPS for endpoints.

The following table describes parameters involved in OBSStaticCredentialProvider:

Table 2 Server identification configurations

Parameter

Description

Method

accessKey

User's AK

credentialProvider.Access_Key = Access_Key

secretKey

User's SK

credentialProvider.Secret_Key = Secret_Key

securityToken

Temporary token

credentialProvider.securityToken = token

credentialProvider is an instance of OBSStaticCredentialProvider.

For details about how to obtain the securityToken, see Setting Up an OBS Environment.

The following table describes parameters involved in OBSHTTPProxyConfiguration:

Table 3 Proxy server configurations

Parameter

Description

Method

proxyType

Network access type (Possible values are enumerated).

To allow HTTP only:

proxyConfig.proxyType=OBSHTTPRroxyTypeHTTP

To allow HTTPS only:

proxyConfig.proxyType=OBSHTTPRroxyTypeHTTPS

To allow both HTTP and HTTPS:

proxyConfig.proxyType=OBSHTTPRroxyTypeHTTPAndHTTPS

proxyHost

Host address of the proxy server.

proxyConfig.proxyHost = @"host"

proxyPort

Port ID of the proxy server.

proxyConfig.proxyPort = @"port"

username

Username used for connecting to the proxy server.

proxyConfig.username = @"username"

password

Password used for connecting to the proxy server.

proxyConfig.password = @"password"

proxyConfig is an instance of OBSHTTPProxyConfiguration.