流程图
?
?
?环境依赖
iOS 8.0 或以上版本且支持音视频的 iOS 设备。
从 App Store 中安装 Xcode。
跑通 Demo
下载 demo
git clone https://github.com/TencentCloud/tencentcloud-sdk-ios-soe.git
使用访达打开 "tencentcloud-sdk-ios-soe/TAIDemo" 文件夹,双击 TAIDemo.xcodeproj。
填写密钥
注意:
实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密。
代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见 云 API 密钥安全方案推荐。
密钥可前往 官网控制台 进行获取。
?
?
?运行项目
连接手机,打开开发者模式,单击 Any iOS Device,选择设备。单击 run 运行项目。下载 App 进行真机调试。
?
?
?使用 demo
?
?
?选择口语评测。
?
?
?单击开始录音或外部 MP3 文件进行评测。
集成 SDK
?
?
?新建项目
1. 运行 Xcode 选择 Create a new Xcode project。如果已有项目,选择 Open a project or file 打开已有项目。
?
?
?2. 选择 App,点击 Next 进入下一步。
?
?
?3. 填入"Product Name","Organization Identifier";"Language"选择"Objective-C","Interface"选择"Storyboard"。点击 Next 进入下一步。
?
?
?4. 选择文件存放位置,单击 Create 创建项目。
?
?
?安装 SDK
安装 CocoaPods
打开终端输入命令。
sudo gem install cocoapods
创建 Podfile 文件
进入项目所在路径,输入以下命令行之后项目路径下会出现一个 Podfile 文件。
pod init
编辑 Podfile 文件
编辑 Podfile 文件,在 target 下添加 pod 'TAISDK_iOS'。
platform :ios, '8.0'target 'TAIDemo' dopod 'TAISDK_iOS'end
更新并安装sdk
1. 使用
pod repo update
命令更新本地库版本,确保能够安装最新版本。2. 在终端窗口中输入
pod install
安装 TAI SDK。3. pod 命令执行完后,会生成集成了 SDK 的 .xcworkspace 后缀的工程文件,双击打开即可。
版本设置(可选)
默认为当前最新版本,如果后续更新或需要使用老版本可以编辑 Podfile 文件,例如需要使用1.2.3.118版本,可以编辑 Podfile 文件,在 pod "TAISDK_iOS" 后加入版本号,然后更新并安装 SDK。可以使用 pod search TAISDK_iOS 查看版本信息。
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'soedemo' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'TAISDK_iOS','1.2.3.118' # Pods for soedemo end
添加依赖
在 TARGETS > Build Phases > Link Binary With Libraries 中,单击 +。输入 libc++.tbd 并选择,单击 Add ,添加 C++ 标准库依赖。
?
?
?设置权限
在 Xcode 中,选择 TARGETS > Info > Custom iOS Target Properties,单击 +,在框中输入 Privacy - Microphone Usage Description 添加麦克风权限。
?
?
?SDK 功能
?