
SDKAppID and SDKSecretKey. These credentials will be required in the subsequent Login steps.pod 'TUICallKit_Swift' dependency in your project's Podfile file. For example:target 'YourProjectTarget' dopod 'TUICallKit_Swift'end
.xcodeproj directory in the terminal, then execute the pod init command to create a Podfile file. After creation, add the pod 'TUICallKit_Swift' dependency in your Podfile file. For example:// 1cd /Users/yourusername/Projects/YourProject// 2pod init// 3 In the generated Podfile filetarget 'YourProjectTarget' dopod 'TUICallKit_Swift'end
Podfile file is located in the terminal, then run the following command to install components.pod update
Info.plist file,these descriptions will be displayed to the user when the system initially prompts for permission.<key>NSCameraUsageDescription</key><string>TUICallKitApp needs access to your camera, and it can be used for functions such as Video Call, Group Video Call.</string><key>NSMicrophoneUsageDescription</key><string>TUICallKitApp needs access to your microphone,and it can be used for functions such as Audio Call, Group Audio Call, Video Call, Group Video Call.</string>

import TUICoreimport TUICallKit_Swiftfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {let userID = "denny" // Please replace with your UserIdlet sdkAppID: Int32 = 0 // Please replace it with the SDKAppID obtained from the console.let secretKey = "****" // Please replace it with the SecretKey obtained from the console.let userSig = GenerateTestUserSig.genTestUserSig(userID: userID, sdkAppID: sdkAppID, secretKey: secretKey)TUILogin.login(sdkAppID, userID: userID, userSig: userSig) {print("login success")} fail: { code, message inprint("login failed, code: \\(code), error: \\(message ?? "nil")")}return true}
#import <TUICore/TUILogin.h>#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {NSString *userID = @"denny"; // Please replace with your UserIDint sdkAppID = 0; // Please replace it with the SDKAppID obtained from the console.NSString *secretKey = @"****"; // Please replace it with the SecretKey obtained from the console.NSString *userSig = [GenerateTestUserSig genTestUserSigWithUserID:userID sdkAppID:sdkAppID secretKey:secretKey];[TUILogin login:sdkAppIDuserID:userIDuserSig:userSigsucc:^{NSLog(@"login success");} fail:^(int code, NSString * _Nullable msg) {NSLog(@"login failed, code: %d, error: %@", code, msg);}];return YES;}
Parameter | Type | Description |
userId | String | only allow a combination of uppercase and lowercase letters (a-z A-Z), numbers (0-9), underline and hyphen |
sdkAppId | int | |
secretKey | String | The SDKSecretKey of the audio and video application created in the Tencent Real-Time Communication (TRTC) Console. |
userSig | String | A security signature used for user login authentication, confirming user authenticity and preventing malicious attacks from stealing your cloud service usage rights. |
GenerateTestUserSig.genTestSig function to generate userSig. In this method, the secretKey is very easy to decompile and reverse. Once your key is leaked, attackers can steal your Tencent Cloud traffic.setSelfInfo function to set your nickname and avatar. The set nickname and avatar will be displayed on the caller/callee interface.import TUICallKit_SwiftTUICallKit.createInstance().setSelfInfo(nickname: "jack", avatar: "https:/****/user_avatar.png") {} fail: { code, message in}
#import <TUICore/TUILogin.h>#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>NSString *nickname = @"jack";NSString *avatar = @"https:/****/user_avatar.png";[[TUICallKit createInstance] setSelfInfo:nickname avatar:avatar callback:nil];
Parameter | Type | Description |
nickname | String | Target user's nickname |
avatar | String | Target user's avatar |
calls function and specifying the media type (voice or video) and the callee's User ID list (userIdList). The calls interface supports both one-to-one and group calls. A one-to-one call is initiated when the userIDList contains only a single User ID; a group call is initiated when it contains multiple User IDs.viewDidLoad method; it should be called in the button's click event or other user interaction response methods.import TUICallKit_Swift// Trigger single-person voice callTUICallKit.createInstance().calls(userIdList: ["mike"], callMediaType: .audio, params: nil) {} fail: { code, message in}
#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>#import <RTCRoomEngine/TUICallEngine.h>[[TUICallKit createInstance] calls:@[@"mike"] callMediaType:TUICallMediaTypeAudio params:NULL succ:^{} fail:^(int code, NSString * _Nullable errMsg) {}];
Parameter | Type | Description |
userIdList | [String] | Target user ID list |
mediaType | Media type of the call, such as video call, voice call | |
params | Call extension parameters, such as room number, call invitation timeout, offline push custom content |
enableFloatWindow. This feature should be enabled when initializing the TUICallKit component, with the default status being Off (false).
import TUICallKit_SwiftTUICallKit.createInstance().enableFloatWindow(enable: true)
[[TUICallKit createInstance] enableFloatWindow:YES];
enableIncomingBanner API: by default (disabled), the callee will immediately display the full-screen call interface upon receiving an invitation, while enabling it will show a notification banner first, followed by launching the full-screen call interface as required.
import TUICallKit_SwiftTUICallKit.createInstance().enableIncomingBanner(enable: true)
[[TUICallKit createInstance] enableIncomingBanner:YES];
calls method to initiate a call, if the list of called users exceeds one person, it is automatically recognized as a multi-person call. Other members can then join this multi-person call using the join method.calls method is used to initiate a call, if the callee User ID list (userIdList) contains more than one user, it will be automatically deemed a multi-person call.import TUICallKit_SwiftTUICallKit.createInstance().calls(userIdList: ["mike", "tate"], callMediaType: .audio, params: nil) {} fail: { code, message in}
#import <TUICallKit_Swift/TUICallKit_Swift-Swift.h>#import <RTCRoomEngine/TUICallEngine.h>[[TUICallKit createInstance] calls:@[@"mike", @"tate"] callMediaType:TUICallMediaTypeAudio params:NULL succ:^{} fail:^(int code, NSString * _Nullable errMsg) {}];
Parameter | Type | Description |
userIdList | [String] | Target user ID list |
mediaType | Media type of the call, such as video call, voice call | |
params | Call extension parameters, such as room number, call invitation timeout, offline push custom content |
join method to enter the specified multi-person call.import TUICallKit_SwiftTUICallKit.createInstance().join(callId: "")
[[TUICallKit createInstance] joinWithCallId: @"***"];
Parameter | Type | Description |
callId | String | The unique ID for this call. |
TUIGlobalization.setPreferredLanguage method.import TUICorefunc steLanguage() {TUIGlobalization.setPreferredLanguage("en")}
Parameter | Type | Description |
language | String | "zh-Hans": Simplified Chinese. "zh-Hant": Traditional Chinese. "en": English. "ar" : Arabic. |
setCallingBell interface to set the incoming call ringtone received by the callee.import TUICallKit_SwiftTUICallKit.createInstance().setCallingBell(filePath: "***/callingBell.mp3")
[[TUICallKit createInstance] setCallingBell:@"***/callingBell.mp3"];
filePath.Parameter | Type | Description |
filePath | String | Ringtone file path |
import TUICallKit_SwiftTUICallKit.createInstance().enableMuteMode(enable: true)
[TUICallKit createInstance] enableMuteMode: YES];
import TUICallKit_Swiftlet params = TUICallParams()let pushInfo: TUIOfflinePushInfo = TUIOfflinePushInfo()pushInfo.title = "TUICallKit"pushInfo.desc = "TUICallKit.have.new.invitation"pushInfo.iOSPushType = .apnspushInfo.ignoreIOSBadge = falsepushInfo.iOSSound = "phone_ringing.mp3"pushInfo.androidSound = "phone_ringing"// OPPO must set ChannelID to receive push message, this channelID needs to be consistent with that in the consolepushInfo.androidOPPOChannelID = "tuikit"// FCM channel ID, you need to change PrivateConstants.java and set "fcmPushChannelId"pushInfo.androidFCMChannelID = "fcm_push_channel"// VIVO message type: 0-push message, 1-system message (high delivery rate)pushInfo.androidVIVOClassification = 1// HuaWei message type: https://developer.HuaWei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835pushInfo.androidHuaWeiCategory = "IM"params.userData = "User Data"params.timeout = 30params.offlinePushInfo = pushInfoTUICallKit.createInstance().call(userId: "123456", callMediaType: .audio, params: params) {} fail: {code, message in}
[TUICallKit createInstance] call:@"mike's id" params:[self getCallParams] callMediaType:TUICallMediaTypeVideo];- (TUICallParams *)getCallParams {TUIOfflinePushInfo *offlinePushInfo = [self createOfflinePushInfo];TUICallParams *callParams = [TUICallParams new];callParams.offlinePushInfo = offlinePushInfo;callParams.timeout = 30;return callParams;}+ (TUIOfflinePushInfo *)createOfflinePushInfo {TUIOfflinePushInfo *pushInfo = [TUIOfflinePushInfo new];pushInfo.title = @"";pushInfo.desc = TUICallingLocalize(@"TUICallKit.have.new.invitation");pushInfo.iOSPushType = TUICallIOSOfflinePushTypeAPNs;pushInfo.ignoreIOSBadge = NO;pushInfo.iOSSound = @"phone_ringing.mp3";pushInfo.AndroidSound = @"phone_ringing";// OPPO must set ChannelID to receive push message, this channelID needs to be consistent with that in the consolepushInfo.AndroidOPPOChannelID = @"tuikit";// FCM channel ID, you need to change PrivateConstants.java and set "fcmPushChannelId"pushInfo.AndroidFCMChannelID = @"fcm_push_channel";// VIVO message type: 0-push message, 1-system message (high delivery rate)pushInfo.AndroidVIVOClassification = 1;message type: https://developer.HuaWei.com/consumer/cn/doc/development/HMSCore-Guides/message-classification-0000001149358835pushInfo.AndroidHuaWeiCategory = @"IM";return pushInfo;}
Icon | File name | Description |
![]() | icon_dialing.png | Answer incoming call icon |
![]() | icon_hangup.png | Hang Up Call icon |
![]() | icon_mute_on.png | Turn off the mic icon |
![]() | icon_handsfree.png | Turn off the speaker icon |
![]() | icon_camera_off.png | Camera Off icon |
![]() | icon_add_user.png | Invite user icon during call |
pod 'TUICallKit_Swift', :path=>"your TUICallKit_Swift.podspec path"

info_rtc@tencent.com.Feedback