Live Streaming
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Electron
  • Unity3D
  • Windows
  • macOS
  • Linux
  • Overview
  • Live Streaming vs. Interactive Live Streaming
  • Develop your app
    • Live Streaming
      • Integrate the SDK
      • Implement a basic live streaming
      • Enhance basic livestream
      • CDN
      • Play live streams
    • Interactive Live Streaming
  • Upgrade the livestream
    • Advanced features
      • Media push
        • Mix the live streams
      • Enhance the livestream
        • Share the screen
        • Improve your appearance in the livestream
        • Beautify & Change the voice
        • Output the livestream in H.265
        • Watermark the live/Take snapshots
        • Config video codec
        • Visualize the sound level
      • Message signaling
        • Convey extra information using SEI
        • Broadcast real-time messages to a room
        • Quotas and limits
      • Ensure livestream quality
        • Test network and devices in advance
        • Check the room connection status
        • Monitor streaming quality
        • Configure bandwidth management
      • Play media files
        • Play media files
        • Play sound effects
      • Record video media data
      • Join multiple rooms
      • Publish multiple live streams
      • Low-latency live streaming
      • Use the bit mask
      • Common audio config
      • Playing streams via URL
    • Distincitve features
      • Set the voice hearing range
      • Single stream transcoding
      • Low-light enhancement
      • Customize the video and audio
  • Upgrade using Add-on
  • Resources & Reference
    • SDK
    • Sample code
    • API reference
      • Client APIs
      • Server APIs
    • Debugging
      • Error codes
    • FAQs
    • Key concepts
  • Documentation
  • Live Streaming
  • Develop your app
  • Live Streaming
  • Integrate the SDK

Integrate the SDK

Last updated:2023-06-09 23:34

Set up the development environment

Before integrating the ZEGO Express SDK, make sure the development environment meets the following requirements:

  • Xcode 13.0 or later
  • An iOS device or iOS Simulator that is running on iOS 11.0 or later and supports audio and video. We recommend you use a real device.
  • The iOS device is connected to the internet.

Create a new project

Skip this step if a project already exists.

Create a new project
  1. Open Xcode, and in the Welcome to Xcode window, click Create a new Xcode project or select File > New > Project. In the dialog that appears, select the iOS tab, then select App in the Application section.

  2. Fill in items or choose options for the new project, click Next after configuration is completed.

    Product Name and Organization Identifier are required, which will be used for creating the App UID - Bundle Identifier.

  3. Choose a particular directory to restore the project to be created, and click Create to create a project.

Import the SDK

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

  1. Open Xcode and click "File > Add Packages..." in the menu bar, enter the following URL in the "Search or Enter Package URL" search box of the "Apple Swift Packages" pop-up window:

    https://github.com/zegolibrary/express-video-ios
  2. Specify the SDK version you want to integrate in "Dependency Rule" (Recommended: use the default rule "Up to Next Major Version"), and then click "Add Package" to import the SDK. You can refer to Apple Documentation for more details.

Method 2: Integrate the SDK automatically with CocoaPods
  1. Install CocoaPods. For more details, see CocoaPods Installation Guide .

  2. Open the Terminal, enter the root directory of the project, and execute the command pod init to create a Podfile.

  3. Open Podfile, add pod 'ZegoExpressEngine', and change MyProject to your target name.

    • Because the SDK is XCFramwork, therefore, you will need to use CocoaPods 1.10.0 or later to integrate the Zego Express SDK.

    • Since version v3.2.0, the Pod name of the Express Video Call SDK is changed from ZegoExpressEngine/Video to ZegoExpressEngine; the Pod name of the Express Voice Call SDK is changed from ZegoExpressEngine/Audio to ZegoExpressAudio.

    target 'MyProject' do
      use_frameworks!
      # Please fill in a specific SDK version number
      # You can get the latest version of the SDK from release note, and modify x.y.z to the specific version number
      pod 'ZegoExpressEngine', '~> x.y.z'
    end
  4. Execute pod repo update to update the local index to make sure the latest version of SDK can be installed. For the latest version number, see ZEGO Express-Video iOS SDK Release History .

  5. Execute pod install to install the SDK.

    For common problems you may encounter when using CocoaPods, see CocoaPods FAQ .

Method 3: Manually add the SDK to the project
  1. Download the latest version of SDK from SDK downloads . We recommend you use XCFramework, and then extract files from the downloaded SDK package.

  2. Copy the SDK dynamic library file ZegoExpressEngine.xcframework to the project directory.

    XCFramework files Introduction

    XCFramework is a new packaging form that includes multi-platform architectures such as real devices and simulators. Please integrate it into the project as a whole, and it is not recommended to disassemble it for use. But if you really only need to integrate the real machine architecture or the simulator architecture separately, you can also take out the .framework in XCFramework and use it separately.

    • ios-arm64: for real iOS devices.

    • ios-arm64_x86_64-maccatalyst: Mac Catalyst package for macOS. Mac Catalyst is a new framework launched by Apple in 2019, namely UIKit for Mac, designed to allow iPad Apps to run on macOS. For details, please refer to Apple Developer - Mac Catalyst

    • ios-arm64_x86_64-simulator: For iOS Simulator.

  3. Open Xcode and select File > Add Files to "xxx" (xxx is the project name) to add the SDK dynamic library files to the project.

  4. Do the following to add the framework file to the project target.

    a) Select the project target.

    b) Click General, then under Frameworks, Libraries, and Embedded Content, click the Add button (+) below the table.

    c) Add ZegoExpressEngine.framework to the target, and set the Embed field to Embed & Sign.

    Dylibembed

Add permissions

Permissions can be set as needed.

  1. Open Xcode, select the target object, and then click Info > Custom iOS Target Properties.

    AddPrivacy

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

    • Privacy - Camera Usage Description

    • Privacy - Microphone Usage Description

      AddPrivacy Done

FAQ

  1. 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.

Page Directory