Interactive Message enhances communication and engagement in live streaming rooms. The SDK lets you add comments, bullet comments, and likes to your live streaming application.
Prerequisites
Before you integrate the client-side SDK, complete the server-side integration and ensure an endpoint is available for the client to get an authentication token. For instructions, see Server-side integration.
Environment requirements
-
Xcode 12.0 or later. We recommend that you use the latest official version.
-
CocoaPods 1.9.3 or later.
-
iOS 10.0 or later for on-device debugging.
Integrate the SDK
-
In your Podfile, add the following dependency:
# Replace x.y.z with the specific SDK version, such as 1.9.0. # You can find the latest version number in the release notes. pod 'AliVCInteractionMessage', '~> x.y.z' -
Run
pod install --repo-update.
Use the SDK
Use the SDK in the following sequence:
-
Initialization
-
Login
-
Operations
-
Logout
-
Deinitialization
-
Others
Import the header file
Import the header file before calling the API.
#import <AliVCInteractionMessage/AliVCInteractionMessage.h>
Initialization
Initialize the SDK at the main entry point of the relevant module before calling any other APIs.
Login
Log in with authentication credentials (timestamp, nonce, and token) obtained from your server.
Group operations
Message operations
Logout
[[AliVCIMEngine sharedEngine] logout:^(NSError * _Nullable error) {
NSLog(@"API - logout result: %@", error ? error.description : @"success");
}];
Deinitialization
After logging out, deinitialize the SDK if you no longer need it. This releases the underlying resources.
int ret = [[AliVCIMEngine sharedEngine] destroy];
NSLog(@"API - destroy result: %d", ret);
Helper APIs
Use these helper APIs to check SDK state before performing operations.
// Check if the SDK has been initialized. Your application can use this to determine if the SDK has been instantiated.
[[AliVCIMEngine sharedEngine] isInited];
// Check if the user is currently logged in. Returns false if the login process is ongoing. Post-login operations, such as joining a group or logging out, can only be performed in the logged-in state.
[[AliVCIMEngine sharedEngine] isLogin];
// Check if the user is currently logged out. Returns false if the login process is ongoing. You can only perform a login operation in the logged-out state.
[[AliVCIMEngine sharedEngine] isLogout];