Initialize the SDK
Initialize the SDK before you use any other Chat UI feature.
If this is your first integration, start with Quickstart to prepare the App Key, token flow, and profile data.
Prepare the App Key
You need a valid App Key before you can initialize the SDK.
If you have multiple apps or multiple environments, make sure that you use the App Key for the correct app and environment. Also confirm which data center that App Key belongs to before you set areaCode.
Set the correct data center
NCInitParams includes an areaCode field that maps the SDK to the correct data center.
Supported values in the current source snapshot are:
NCAreaCodeBj/.bjfor Beijing, ChinaNCAreaCodeSg/.sgfor SingaporeNCAreaCodeNa/.nafor North AmericaNCAreaCodeSa/.safor Saudi ArabiaNCAreaCodeOm/.omfor Oman
The current default is Singapore (NCAreaCodeSg / .sg). Set areaCode explicitly when the App Key belongs to another data center.
Set naviServer only when your environment requires a private navigation server. For standard public cloud environments, leave it unset so the SDK uses the navigation server for the selected data center.
Initialize the SDK
Objective-C:
#import <NexconnChatSDK/NexconnChatSDK.h>
#import <NexconnChatUI/NexconnChatUI.h>
NSString *appKey = @"Your_AppKey";
NCInitParams *params = [[NCInitParams alloc] initWithAppKey:appKey];
params.areaCode = NCAreaCodeSg; // Replace with the area code for this app key.
// params.naviServer = @"https://your-navi-server.example.com"; // Private navigation only.
[[NCChatUI shared] initializeWithParams:params];
Swift:
import NexconnChatSDK
import NexconnChatUI
let params = NCInitParams(appKey: "Your_AppKey")
params.areaCode = .sg // Replace with the area code for this app key.
// params.naviServer = "https://your-navi-server.example.com" // Private navigation only.
NCChatUI.shared().initialize(with: params)
Optional initialization settings
NCInitParams also exposes these commonly used settings:
naviServer: Overrides the navigation server address. Use this only for private navigation environments.crashMonitorEnabled: Enables SDK crash monitoring. The current default istrue.logLevel: Sets the SDK log level. Supported values arenone,error,warn,info,debug, andverbose.enableSyncEmptyTopConversation: Controls synchronization for empty pinned channels. The current default isfalse.forceKeepAlive: Controls whether the SDK keeps the connection alive in the background. The current default isfalse.
Example:
NCInitParams *params = [[NCInitParams alloc] initWithAppKey:@"Your_AppKey"];
params.areaCode = NCAreaCodeSg;
// params.naviServer = @"https://your-navi-server.example.com"; // Private navigation only.
params.crashMonitorEnabled = YES;
params.logLevel = NCLogLevelInfo;
[[NCChatUI shared] initializeWithParams:params];
Next steps
After initialization, continue with: