主頁(yè) > 服務(wù)與支持 > 開(kāi)發(fā)平臺(tái) > 客戶端SDK參考 > iOS UI SDK > 快速入門 快速入門
更新時(shí)間:2019-11-20
以實(shí)現(xiàn)登錄企業(yè)云通信服務(wù)器并加入視頻會(huì)議為例,介紹如何使用iOS SDK進(jìn)行二次集成開(kāi)發(fā)。
在開(kāi)發(fā)的過(guò)程中請(qǐng)滿足如下環(huán)境要求。
環(huán)境和工具名稱 |
版本要求 |
說(shuō)明 |
---|---|---|
操作系統(tǒng) |
Mac OSX High Sierra 10.13.6及以上 |
- |
Xcode |
Xcode9.4.1及以上 |
其他IDE工具。 |
iOS系統(tǒng)版本 |
iOS9.0及以上,64位設(shè)備 |
- |
會(huì)議云服務(wù)的用戶帳號(hào) |
- |
帳號(hào)可來(lái)源于華為公有云。開(kāi)通方法請(qǐng)參見(jiàn)“開(kāi)發(fā)前準(zhǔn)備”。 |
兩種配置下需要配置的文件分別如下圖所示,需要按照此順序進(jìn)行配置。
在調(diào)用CloudLinkMeeting接口的文件中必須包含以下頭文件。
#import <CloudLink_Meeting/CloudLinkMeeting.h>
CloudLinkMeeting包含了如下這幾個(gè)接口。
/** 初始化配置接口 @param initParam 初始化參數(shù) @param completionBlock 完成回調(diào) */ - (void)clm_init:(clmInitParam *)initParam completionBlock:(clmActionCompletionBlock)completionBlock; /** 登錄接口 @param loginParam 登錄參數(shù) @param completionBlock 完成回調(diào)(需要先初始化才能調(diào)用) */ - (void)clm_login:(clmLoginParam *)loginParam completionBlock:(clmActionCompletionBlock)completionBlock; /** 創(chuàng)建會(huì)議接口 @param createParam 創(chuàng)會(huì)參數(shù) @param completionBlock 完成回調(diào)(需要先初始化登錄才能調(diào)用) */ - (void)clm_createMeeting:(clmCreateMeetingParam *)createParam completionBlock:(clmActionCompletionBlock)completionBlock; /** 攜帶與會(huì)者創(chuàng)建會(huì)議接口 @param createParam 創(chuàng)會(huì)參數(shù) @param participants 與會(huì)者參數(shù) @param completionBlock 完成回調(diào)(需要先初始化登錄才能調(diào)用) */ - (void)clm_createMeeting:(clmCreateMeetingParam *)createParam withParticipants:(NSArray <clmMeetingParticipantParam *>*)participants completionBlock:(clmActionCompletionBlock)completionBlock; /** 使用會(huì)議ID入會(huì)接口 @param joinParam 加入會(huì)議參數(shù) @param completionBlock 完成回調(diào)(需要先初始化登錄才能調(diào)用) */ - (void)clm_joinMeetingById:(clmJoinMeetingParam *)joinParam completionBlock:(clmActionCompletionBlock)completionBlock;
需要在demo中新增控件分別用于四個(gè)接口的調(diào)用使用,其中后面三個(gè)接口需要參數(shù)輸入,因此需要有UI控件界面支持參數(shù)輸入。
下面分別列舉各個(gè)接口的調(diào)用示例;
1. 初始化接口:(其他接口調(diào)用之前必須先初始化)
- (void)clm_init:(clmInitParam *)initParam completionBlock:(clmActionCompletionBlock)completionBlock
- (void)initClm { //調(diào)用接口 CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; //init第一個(gè)參數(shù)為配置信息字符串,為預(yù)留,沒(méi)有特殊需求的時(shí)候可以傳遞nil [clm clm_init:nil completionBlock:^(NSError *error) { //響應(yīng)回調(diào)處理,這里的示例對(duì)返回做了打印處理,error為nil表示成功 NSLog(@"clm_init result is:%@", error); }]; }
2. 登錄接口:
- (void)clm_login:(clmLoginParam *)loginParam
completionBlock:(clmActionCompletionBlock)completionBlock
- (void)loginToClm { //登錄參數(shù)準(zhǔn)備,這里以TextField輸入為示例 CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; clmLoginParam *loginParam = [[clmLoginParam alloc] init]; loginParam.account = self.userAccountField.text; loginParam.password = self.userPasswordField.text; //調(diào)用接口 [clm clm_login:loginParam completionBlock:^(NSError *error) { //響應(yīng)回調(diào)處理,這里的示例對(duì)返回做了打印處理,error為nil表示成功 NSLog(@"clm_login result is:%@", error); }]; }
3.創(chuàng)會(huì)接口:
- (void)clm_createMeeting:(clmCreateMeetingParam *)createParam
completionBlock:(clmActionCompletionBlock)completionBlock;
使用示例如下。
- (void)createClmConf { //創(chuàng)會(huì)參數(shù)準(zhǔn)備,這里以TextField輸入作為示例 CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; clmCreateMeetingParam *param = [[clmCreateMeetingParam alloc] init]; param.meetingSubject = self.subjectTextField.text; param.meetingType = (self.mediaTypeSwitch.isOn ? CONF_MEDIA_FLAG_VIDEO_DATA : CONF_MEDIA_FLAG_VOICE_DATA); //調(diào)用接口 [clm clm_createMeeting:param completionBlock:^(NSError *error) { //響應(yīng)回調(diào)處理,這里的示例對(duì)返回做了打印處理,error為nil表示成功 NSLog(@"create clm conf ,error is:%@", error); }]; }
4.創(chuàng)會(huì)接口(攜帶與會(huì)者):
- (void)clm_createMeeting:(clmCreateMeetingParam *)createParam
withParticipants:(NSArray<clmMeetingParticipantParam *> *)participants
completionBlock:(clmActionCompletionBlock)completionBlock;
- (void)createClmConfWithParticipants { //創(chuàng)會(huì)參數(shù)準(zhǔn)備,這里以TextField輸入作為示例 CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; clmCreateMeetingParam *param = [[clmCreateMeetingParam alloc] init]; param.meetingSubject = self.subjectTextField.text; param.meetingType = (self.mediaTypeSwitch.isOn ? CONF_MEDIA_FLAG_VIDEO_DATA : CONF_MEDIA_FLAG_VOICE_DATA); //與會(huì)者參數(shù)準(zhǔn)備,這里以TextField輸入為示例,這里僅添加一個(gè)與會(huì)者作為示例 clmMeetingParticipantParam *participant = [[clmMeetingParticipantParam alloc] init]; participant.number = self.participantNumberTextField.text; participant.name = self.participantNameTextField.text; NSarray *participants = @[participant]; //調(diào)用接口 [clm clm_createMeeting:param withParticipants:participants completionBlock:^(NSError *error) { //響應(yīng)回調(diào)處理,這里的示例對(duì)返回做了打印處理,error為nil表示成功 NSLog(@"create clm conf ,error is:%@", error); }]; }
5.入會(huì)接口:
- (void)clm_joinMeetingById:(clmJoinMeetingParam *)joinParam
completionBlock:(clmActionCompletionBlock)completionBlock;
- (void)joinClmConf { //入會(huì)參數(shù)準(zhǔn)備,這里以TextField輸入作為示例 CloudLinkMeeting *clm = [CloudLinkMeeting sharedInstance]; clmJoinMeetingParam *param = [[clmJoinMeetingParam alloc] init]; param.meetingID = self.confIdField.text; param.accessCode = self.accessCodeField.text; //調(diào)用接口 [clm clm_joinMeetingById:param completionBlock:^(NSError *error) { //響應(yīng)回調(diào)處理,這里的示例對(duì)返回做了打印處理,error為nil表示成功 NSLog(@"clm join meeting, result is:%@", error); } }]; }
完成上述接口調(diào)用代碼后即可完成基于CloudLinkMeeting iOS的demo,更詳細(xì)信息請(qǐng)參考CloudLinkMeetingDemo樣例代碼。