đ 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â
The SDK can only be initialized once.
Other API calls must ensure that operations are performed after a successful login callback.