Skip to main content

🚀 Using the Demo​

We strongly recommend you start by running the framework-specific example DEMO we have prepared for you. This will not only allow you to experience the features of OpenIMSDK firsthand but will also assist you in quickly identifying and addressing issues during the actual integration process.

Integration Steps​

1. Currently, the SDK is obtained through cocoapods. Add the dependency to Podfile:​

pod 'OpenIMSDK', '~>3.0.0'

For SDK version reference: https://github.com/OpenIMSDK/Open-IM-SDK-iOS.git

2. Import the module​

@import OpenIMSDK;

3. Initialization​

OIMInitConfig *config = [OIMInitConfig new];
config.apiAddr = @"";
config.wsAddr = @"";
config.objectStorage = @"";

BOOL success = [OIMManager.manager initSDKWithConfig:config
onConnecting:^{

} onConnectFailure:^(NSInteger code, NSString * _Nullable msg) {
// Callback function for connection failure
// code error code
// error error message
} onConnectSuccess:^{
// SDK has successfully connected to the IM server
} onKickedOffline:^{
// SDK is connecting to the IM server
} onUserTokenExpired:^{
// Token has expired while online: at this point, you need to generate a new token and call the login() function again to log in.
}];

4. Login​

[OIMManager.manager login:@""
token:@""
onSuccess:^(NSString * _Nullable data) {

} onFailure:^(NSInteger code, NSString * _Nullable msg) {

}];

Notes​

  1. The SDK can only be initialized once.

  2. Other API calls must ensure that operations are performed after a successful login callback.