Low-Latency Live Streaming
  • Platform
  • Framework / Engine
  • iOS
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program

Integrating the SDK

Update Time:2021-04-02 18:25

1 Set up the Development Environment

Please ensure that the development environment meets the following technical requirements:

  • Xcode 5.0 or higher
  • An iOS device running on iOS 7.0 or higher version with a camera and microphone. You may run your project on a simulated iOS device, but using a real device is recommended.
  • The iOS device and your computer are connected to the Internet.

2 Integrate the SDK into Your Project

2.1 Choose either of the following methods to integrate the ZEGO Express SDK into your project.

Method 1: Integrate the SDK Automatically with CocoaPods

  1. If you have not already done so, follow the CocoaPods Installation Guide to install CocoaPods on your computer.

  2. Open a Terminal window, cd into the root directory of your project, and run pod init to create a Podfile.

  3. Open your Podfile, and add a CocoaPod by specifying pod 'ZegoExpressEngine' inside your target block as illustrated below.

     target 'MyProject' do
       use_frameworks!
       pod 'ZegoExpressEngine/Video'
     end
  4. Run pod repo update to update the local index to ensure that the latest version of ZegoExpressEngine will be installed. Please refer to the ZEGO Express-Video iOS SDK Release History for the latest version.

  5. Run pod install to install the ZegoExpressEngine.

    Please refer to the “CocoaPodsFAQ” page for the troubleshooting of common problems you may encounter using CocoaPods.

    If you want to use the Express-Video SDK that has the Whiteboard feature, please use the command: pod ZegoExpressEngine/Whiteboard.

Method 2: Manually add SDK to the project

  1. Download the SDK

    Please download the SDK from ZegoExpressEngine iOS , it is recommended to download and use XCFramework.

  2. Import SDK

The official website provides two different packaging types of SDK, divided into XCFramework and traditional Framework.

  1. XCFramework contains SDKs for iOS + iOS (Simulator) + macOS, which is recommended.

  2. There are two folders in the download package of the traditional Framework: armv7-arm64 and armv7-arm64-x86_64, the differences are as follows:

    a. armv7-arm64 is only used for real machine debugging. Users need to use the ZegoExpressEngine.framework under this file in the final release, otherwise they may be called back by Apple.

    b. armv7-arm64-x86_64 contains libraries for real machine and simulator debugging. If you use the simulator to debug during the development process, you need to import the ZegoExpressEngine.framework under this folder. But when it is finally released, switch back to the framework under the armv7-arm64 folder. Note that this library may encounter compilation problems after Xcode 12.3, please refer to [FAQ-2].

Please select an SDK file that meets the development requirements.

  1. Manually copy the SDK dynamic library file ZegoExpressEngine.framework to the project directory.

  2. Open Xcode and use [Add Files to "xxx" (xxx is the user's project name)] to add the SDK dynamic library files to the project.

  

  1. Configure SDK

    In Xcode, select: Project TARGETS -> General -> Frameworks, Libraries, and Embedded Content, add ZegoExpressEngine.framework, and set Embed to Embed & Sign.

    Dylibembed

3 Add permissions

Select the project TARGETS -> Info -> Custom iOS Target Properties

AddPrivacy

Click the + Add button to add camera and microphone permissions.

  1. Privacy-Camera Usage Description

  2. Privacy-Microphone Usage Description

After the addition is complete, as shown in the figure:

AddPrivacy Done

4 FAQ

  1. An error was reported when packaging: Failed to verify bitcode in ZegoExpressEngine.framework/ZegoExpressEngine

    Please check whether the Xcode version is too low, and it is recommended to update the latest Xcode version; if you must use the old version of Xcode for packaging, please find the Enable Bitcode option in the project's Build Setting and set it to NO, and then use the terminal cd to the path where ZegoExpressEngine.framework is stored in your project, and execute the following command to remove the bitcode in the SDK

    xcrun bitcode_strip ZegoExpressEngine.framework/ZegoExpressEngine -r -o ZegoExpressEngine.framework/ZegoExpressEngine
  2. When running the App, it prompts Building for iOS Simulator, but the linked and embedded framework'ZegoExpressEngine.framework' was built for iOS + iOS Simulator.

    After Xcode 12.3, the framework with iOS + iOS (Simulator) dual-platform architecture is prohibited by default. It is recommended to replace it with XCFramework recommended by Apple (you can choose to download XCFramework in the drop-down box in Download SDK Package). Or you can select "TARGETS > Build Settings > Validate Workspace" through Xcode and set the value of this parameter to YES to continue using the traditional framework.

After integrating the SDK, you can proceed to initialize the SDK. Use the next/previous buttons below or the side navigation bar on the left to navigate to the related documents.

  • Quick Start - Initializing the SDK