#iOS-CFHMSDK 版本信息:1.0.0
本 SDK 提供统一的 JSBridge 通信机制,支持 H5 页面与 iOS 原生间的数据交互,主要功能包括获取授权信息、录音控制、数据同步等。
WebKit.framework、AVFoundation.framework推荐使用 CocoaPods 集成:
use_modular_headers!
pod 'Masonry'
pod 'YYModel', :git => 'https://gitee.com/mirrors/YYModel.git', :tag => '1.0.4'
pod 'SDWebImage', :git => 'https://github.com/SDWebImage/SDWebImage.git', :tag => '5.21.0'
手动集成:
下载 .framework 文件拖入项目
配置 info.plist 权限项:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>Allow Arbitrary Loads in Web Content</key>
<true/>
</dict>
<key>Privacy - Microphone Usage Description</key>
<string>App需要访问您手机的麦克风权限,为您提供录音功能服务</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
🚀 快速开始
1. 初始化 WebView 与录音服务
#import <CLHMWebSDK/CLHMWebSDK.h>
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
// 配置 config ...
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
CLHMRecorderService *recorderService = [[CLHMRecorderService alloc] initWithWebView:webView
urlStr:@"https://itest.clife.net/homing/mobile/flash-note/#/pages/sdkAuth/index"
userInfoModel:self.model
inView:self.view];
2. 必传参数模型
UserInfoModel:包含员工与客户信息(参考 demo 示例 JSON)
TagData:用户标签数据
CLHMTokenModel:授权信息(access_token 等)
🔄 回调方法(供原生接收 JS 调用)
回调事件 类型/参数
获取授权信息 JSAuthInfoMethodCompletionResult
获取顾客标签 JSCustomerTagCompletionResult
同步面诊详情 JSFaceAnswerRecordDetailDataCompletionResult
同步录音时长 JSFaceAnswerRecordTimeDataCompletionResult
获取问诊信息 JSOuterConsultInfoMethodCompletionResult
SDK 退出 JSHandleDestroyDataCompletionResult
录音中断(如电话进入) recordingStatusInterruptCallback
⚠️ 注意:务必在控制器 dealloc 方法中释放资源:
- (void)dealloc {
[self.recorderService destroy];
}
📂 示例项目
请联系项目管理员获取 demo 下载地址。
版权所有 © 深圳数联天下智能科技有限公司