You need to enable JavaScript to run this app.
文档中心
企业直播

企业直播

复制全文
下载 pdf
iOS 开播 SDK
iOS 开播 SDK 升级指南
复制全文
下载 pdf
iOS 开播 SDK 升级指南

如需将 iOS 开播 SDK 从 1.55.0 或之前的版本升级到 1.56.0 或之后的版本,并且需要使用美颜、滤镜和道具贴纸功能,请完成以下步骤:

  1. 在 Xcode 的 App Target 下,打开 AppDelegate.m 文件。

  2. AppDelegate.m 文件中,完成以下操作:

    1. 删除对 TTSDK 的引用,如下所示。

      • 如使用动态库版本的 TTSDK

        #import <TTSDKFramework/TTSDKManager.h>
        
      • 如使用静态库版本的 TTSDK

        #import <TTSDK/TTSDKManager.h>
        
    2. 引入 BDLive 头文件。

      #import <BDLive/BDLive.h>
      
    3. 删除 initTTSDK 的实现,将 [self initTTSDK] 替换为 [self initBDLive]

    4. 添加 initBDLive 的实现,如下所示。

      - (void)initBDLive {
          BDLiveAuthInfo *authInfo = [[BDLiveAuthInfo alloc] init];
          authInfo.bizType = BDLiveBizTypeLiveStreaming; // 如果同时集成开播 SDK 和观播 SDK,可将 BDLiveBizTypeLiveStreaming 替换为 BDLiveBizTypeViewer | BDLiveBizTypeLiveStreaming。
          authInfo.appId = @"APP_ID"; // 将 APP_ID 替换为在 SDK 应用创建后生成的 App ID。
          authInfo.appName = @"APP_NAME"; // 将 APP_NAME 替换为创建 SDK 应用时填写的 App 名称。
          authInfo.channel = @"CHANNEL_NAME"; // 将 CHANNEL_NAME 替换为 App 的渠道名称。默认为 App Store。
          authInfo.liveLicensePath = [[NSBundle mainBundle] pathForResource:@"LIVE_LICENSE_NAME" ofType:@"lic"];// 将 LIVE_LICENSE_NAME 替换为直播 License 文件的名称。
      
          // 设置 CV License 授权信息。
          // 离线授权。
          authInfo.effectAuthInfo.authType = BDLiveEffectAuthTypeOffLine;
          authInfo.effectAuthInfo.licenseFilePath = [[NSBundle mainBundle] pathForResource:@"CV_LICENSE_NAME" ofType:@"licbag"]; //  将 CV_LICENSE_NAME 替换为 CV License 文件的名称。
          // 在线授权。
          authInfo.effectAuthInfo.authType = BDLiveEffectAuthTypeOnLine;
          authInfo.effectAuthInfo.key = @"KEY"; // 将 KEY 替换为您的业务标识。请联系智能美化特效产品的 CV 技术支持获取。
          authInfo.effectAuthInfo.secret = @"SECRET"; // 将 SECRET 替换为您的业务密钥,业务密钥可在创建业务时同业务标识一起获得。请联系智能美化特效产品的 CV 技术支持获取。
          // 初始化 SDK。请在连接网络后调用该方法。您可通过 complete 回调获取到 License 的授权结果。   
          [[BDLiveManager sharedInstance] startWithAuthInfo:authInfo complete:^(BOOL allSuccess, NSString * _Nullable warningInfo, NSArray<NSError *> * _Nullable errors) {
              NSLog(@"BDLive 【allSuccess】 %d \n 【warningInfo】: %@ 【errors】:\n\n%@", allSuccess, warningInfo, errors);
          }];
      }
      

    相关方法,详见 startWithAuthInfo:complete:

  3. 打开定义如何进入直播间的文件,删除美颜授权相关代码,以免编译不通过。

    // 配置美颜、滤镜和道具贴纸功能。通过离线或在线方式获取授权。
    model.effectConfig = [[BDLEffectConfig alloc] init];
    // 离线授权。
    model.effectConfig.licenseMode = BDLEffectConfigLicenseModeOffline;
    model.effectConfig.licenseFilePath = [[NSBundle mainBundle] pathForResource:@"CV_LICENSE_NAME" ofType:@"licbag"]; //  将 CV_LICENSE_NAME 替换为 CV License 文件的名称。
    // 在线授权。
    model.effectConfig.licenseMode = BDLEffectConfigLicenseModeOnline;
    model.effectConfig.key = @"KEY"; // 将 KEY 替换为您的业务标识。请联系智能美化特效产品的 CV 技术支持获取。
    model.effectConfig.secret = @"SECRET"; // 将 SECRET 替换为您的业务密钥,业务密钥可在创建业务时同业务标识一起获得。请联系智能美化特效产品的 CV 技术支持获取。
    
最近更新时间:2026.06.17 19:11:33
这个页面对您有帮助吗?
有用
有用
无用
无用