This topic shows you how to integrate the short video SDK for iOS in pod mode and manually integrate the SDK.

Prerequisites

The required environments are prepared. The following table describes the required environments for development.
Environment Description
iOS iOS 9.0 or later.
macOS High Sierra macOS High Sierra 10.13 or later.
Xcode Xcode 9.0 or later. To download Xcode, visit Mac App Store.

SDK reference

For more information, see AliyunVideoSDKPro Reference.

Integrate the SDK in pod mode (recommended)

Procedure

  1. Add dependencies to the Podfile file. The following table describes the dependencies for each edition.
    Notice If you use the short video SDK 3.24.0 or later, you must use FFmpeg 4.3.0 or later.
    pod 'AliyunVideoSDKPro', '~> 3.25.1'
    pod 'QuCore-ThirdParty', '4.3.0'# Required dependency for FFmpeg 4.3.0 or later.
    pod 'AlivcConan', '1.0.3'
    pod 'VODUpload'
    pod 'AliyunOSSiOS'
  2. Update the pod repository.
    pod repo update
  3. Install the pod.
    pod install
Note Make sure that you can access and update the pod repository over the network. After the pods are installed, check whether the framework versions are the latest, as listed on the official website.

Manually integrate the SDK (not recommended)

To manually integrate the SDK Standard Edition or Basic Edition, you must download the latest release package from GitHub, including six libraries and a bundle resource package.
Name Type Description Download URL
AliyunVideoSDKPro Static library Short video SDK Professional Edition
AliyunVideoCore Dynamic library Short video SDK Professional Edition
AliyunVideoSDKPro.bundle Resource package Short video SDK Professional Edition
alivcffmpeg Dynamic library FFmpeg library GitHub
AlivcConan Dynamic library Tool library GitHub
VODUpload Static library Upload library of ApsaraVideo VOD GitHub
AliyunOSSiOS Static library OSS upload library GitHub
Among the preceding libraries, AliyunVideoCore, alivcffmpeg, and AlivcConan are dynamic libraries. When you manually integrate and release dynamic libraries, take note of the following items:
  1. To add a dynamic library, choose TARGETS > General > Embedded Binaries.
  2. Before you submit a dynamic library to App Store, you must strip dynamic libraries of the x86-based simulator architecture. Otherwise, App Store rejects your application. You can strip dynamic libraries of the x86-based simulator architecture by using one of the following methods:
    • Use the lipo command line tool to strip dynamic libraries of the x86-based simulator architecture.
    • Integrate dynamic libraries in pod mode. This way, dynamic libraries of the x86-based simulator architecture are automatically stripped when the pods are packaged.

Procedure

  1. Add dynamic libraries.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click +. Select Add Other... from the drop-down list and import the AliyunVideoCore.framework, AlivcConan.framework, and alivcffmpeg.framework libraries. After the libraries are imported, select Embed & Sign.
  2. Add static libraries.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click +. Select Add Other... from the drop-down list and import the AliyunVideoSDKPro.framework, AliyunOSSiOS.framework, and VODUpload.framework libraries.
  3. Add other libraries.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click + and import the MobileCoreServices.framework, SystemConfiguration.framework, and libresolv.tbd libraries.
  4. Integrate the SDK Professional Edition.
    Import the AliyunVideoSDKPro.bundle resource package to your project.
Note

Manual integration of an SDK is complex and requires you to strip dynamic libraries when you submit a dynamic library to App Store. We recommend that you integrate the SDK in pod mode.

If an error occurs during compilation, set the Compile Sources As parameter to Objective-C++ in the Apple Clang - Language section of the Build Settings tab.

Configure the project

After the SDK is integrated, open the project and modify the configurations.

  1. Choose Build Setting > Linking > Other Linker Flags and add -ObjC.
  2. Choose Build Setting > Build Options and set the Enable Bitcde parameter to NO.
  3. Open the info.Plist file of the project and add the following permissions:
    Privacy - Camera Usage Description
    Privacy - Microphone Usage Description
    Privacy - Photo Library Usage Description