Importing the SDK
You can choose any of the following methods:
- Use CocoaPods to add remote dependencies and import the Framework
- Use CocoaPods to add remote dependencies and import the IMKit SDK source code
- Manually import the Framework (manual integration does not support importing source code)
- Starting from version 5.16.1, IMKit SDK can be imported via
Swift Package Manager
.
Environment Requirements
- Xcode version 11 or higher is required.
- iOS devices must run iOS 9.0 or later.
- If you plan to integrate the SDK via CocoaPods, CocoaPods 1.10.0 or higher is required. This is because IMLib SDK versions after 5.1.1 transitioned to XCFramework, and CocoaPods fully supports XCFramework integration only from version 1.10.0 onward. For details, refer to the Knowledge Base Documentation.
- Swift Package Manager requires Swift 5.0 or higher.
To install the CocoaPods environment, refer to Installing CocoaPods.
Version Check
Before importing the SDK, visit the RC SDK Download Page to confirm the latest version number.
CocoaPods
CocoaPods users can import either the Framework or the IMKit source code.
Use the same method to import IMKit and its plugins. Do not mix Framework and source code in the same Podfile. For details, see SDK Open Source Code Notes.
Importing the Framework
-
If your project does not have a
Podfile
, open Terminal, navigate to the project's root directory, and run thepod init
command. This will automatically create a defaultPodfile
. Add the following content to thePodfile
:pod 'RongCloudIM/IMKit','~> x.y.z' #IMKit
pod 'RongCloudIM/Sight','~> x.y.z' #Short video (optional)
pod 'RongCloudIM/RongSticker','~> x.y.z' #Stickers (optional)
pod 'RongCloudIM/ContactCard','~> x.y.z' #Business cards (optional)
pod 'RongCloudIM/LocationKit','~> x.y.z' #Location (optional)tip- Replace
x.y.z
with the specific version number of IMLib. You can check the latest version on the RC SDK Download Page or by runningpod repo update
followed bypod search RongCloudIM
in Terminal. - Starting from SDK version 5.2.3, the LocationKit plugin is no longer built-in. You can manually integrate it if needed. For SDK versions before 5.2.3, the LocationKit plugin is built-in and does not require manual integration.
- Replace
-
Open Terminal, navigate to the directory containing the
Podfile
, and run the following command:pod install
tipIf you encounter errors like
CocoaPods could not find compatible versions for
, first runpod repo update
in Terminal, then runpod install
. -
Open the
xcworkspace
file in your project directory using Xcode to load the project. -
Reference the library header files as follows:
#import <RongIMKit/RongIMKit.h>
#import <RongSight/RongSight.h>
#import <RongSticker/RongSticker.h>
#import <RongContactCard/RongContactCard.h>
#import <RongLocationKit/RongLocationKit.h>
Importing Source Code
IMKit SDK versions 5.0 and above provide open-source UI libraries, allowing debugging and integration via CocoaPods in source code form.
-
If your project does not have a
Podfile
, open Terminal, navigate to the project's root directory, and run thepod init
command. This will automatically create a defaultPodfile
. Add the following content to thePodfile
:pod 'RongCloudOpenSource/IMKit','x.y.z' #IMKit, including conversation list, chat UI, and input toolbar
pod 'RongCloudOpenSource/Sight','x.y.z' #Short video (optional)
pod 'RongCloudOpenSource/RongSticker','x.y.z' #Stickers (optional)
pod 'RongCloudOpenSource/IFly','x.y.z' #Voice input (optional)
pod 'RongCloudOpenSource/ContactCard','x.y.z' #Business cards (optional)
pod 'RongCloudOpenSource/LocationKit','x.y.z' #Location (optional)tip- Replace
x.y.z
with the specific version number. Different SDKs may have different latest versions, which can be checked on the RC SDK Download Page or in the CocoaPods repository. - The
IFly
(voice input) plugin is only supported via source code integration. If you need this plugin, you must integrate the IMKit SDK via source code. - For IMKit versions before 5.1.8, the ContactCard plugin is only supported via source code integration and requires IMKit SDK to be integrated via source code.
- For IMKit versions 5.1.8 and later, the ContactCard plugin supports both source code and Framework integration. Use the same method to integrate IMKit and its plugins; do not mix Framework and source code.
- Replace
-
Open Terminal, navigate to the directory containing the
Podfile
, and run the following command:pod install
tipIf you encounter errors like
CocoaPods could not find compatible versions for
, first runpod repo update
in Terminal, then runpod install
. -
Open the
xcworkspace
file in your project directory using Xcode to load the project. -
Reference the library header files as follows:
#import <RongCloudOpenSource/RongIMKit.h>
#import <RongCloudOpenSource/RongSight.h>
#import <RongCloudOpenSource/RongSticker.h>
#import <RongCloudOpenSource/RongiFlyKit.h>
#import <RongCloudOpenSource/RongContactCard.h>
#import <RongCloudOpenSource/RongLocationKit.h>
For custom UI requirements, we recommend the following:
- Avoid modifying the source code directly to prevent overwriting changes during future updates.
- Extend business logic by inheriting and overriding methods that differ from your logic, or by adding new methods.
- Use the SDK's public interfaces. Calling private interfaces may lead to issues during version upgrades due to changes in private interfaces.
SDK Open Source Code Notes
-
IMLib (green) exists as a framework and belongs to
RongCloudIM
. -
RTCLib and CallLib (yellow) exist as frameworks and belong to
RongCloudRTC
. -
IMKit and its plugins, along with CallKit (white), can exist as source code and belong exclusively to
RongCloudOpenSource
.The white components (IMKit, Sticker, IFly, ContactCard, CallKit) in the diagram may have corresponding Frameworks. However, in your project, these components must all be integrated either as source code or as Frameworks to avoid conflicts.
Swift Package Manager
IMKit SDK supports Swift Package Manager
integration starting from version 5.16.1.
- Open your Xcode project.
- Click File > Add Package Dependency.
- In the pop-up window's search bar, paste one of the following URLs:
- Xcode will display a list of RC SDK components. IMKit provides core IM UI capabilities, while other components can be selected based on your business needs.
Component Overview
The RC IM SDK offers the following components for developers to choose from. Sight and Sticker are optional, while the rest are required. Descriptions are as follows:
Swift Package | Dynamic Library | Description |
---|---|---|
IMLibCore | RongIMLibCore.xcframework | Core IM functionality. |
ChatRoom | RongChatRoom.xcframework | Chatroom functionality (includes IMLibCore) |
CustomerService | RongCustomerService.xcframework | Customer service functionality (includes IMLibCore) |
Discussion | RongDiscussion.xcframework | Discussion group functionality (includes IMLibCore) |
PublicService | RongPublicService.xcframework | Official account functionality (includes IMLibCore) |
IMKit | RongIMkit.xcframework | UI display functionality |
Sight | RongSight.xcframework | Short video functionality |
Sticker | RongSticker.xcframework | Sticker functionality |
Manual Integration (Framework Only)
Manual integration only supports Framework integration. Source code integration is not supported.
-
Visit the RC SDK Download Page to download the IMKit SDK locally.
-
Open your project in Xcode and manually drag the downloaded SDK into your project. The required SDKs are as follows:
Framework Resource Files IMLib - RongIMLib.xcframework
- RongIMLibCore.xcframework
- RongChatRoom.xcframework
- RongCustomerService.xcframework
- RongDiscussion.xcframework
- RongLocation.xcframework
For versions 5.2.5 and later, this is not required if the LocationKit plugin is not used - RongPublicService.xcframework
- RCConfig.plist
IMKit - RongIMKit.xcframework
- Emoji.plist
- RCColor.plist
- RongCloud.bundle
- zh-Hans.lproj
- ar.lproj
- en.lproj
LocationKit (optional) - RongLocationKit.xcframework
Translation (optional) - RongTranslation.xcframework
Sticker (optional) - RongSticker.xcframework
- RongSticker.bundle
- en.lproj
- zh-Hans.lproj
- ar.lproj
Sight (optional) - RongSight.xcframework
tipThe Translation plugin is only supported in SDK versions 5.2.2 and later and is currently only available for applications using the Singapore data center.
-
Modify your project configuration. Under
General
->Frameworks, Libraries, and Embedded Content
, change all manually imported IMKit SDK Frameworks toEmbed & Sign
.