Integrate the SDK
Prerequisites
Before you integrate the ZegoAvatar SDK, ensure that the development environment meets the following requirements:
- Xcode 5.0 or later.
- The iOS system is in version 11.0 or later and supports audio and video real iOS devices.
- An real iOS device that is running on iOS 11 or later and supports audio and video.
- The front camera and microphone of the device function normally.
Integrate the SDK
1. Optional: Create a project
Skip this step if a project already exists.
- Start Xcode. In the Welcome to Xcode window, select Create a new Xcode project or select File > New > Project. In the table form that is displayed, select the iOS platform, select Application > App, and click Next.
Fill in the table form, select the desired options to configure a project, and click Next.
Product Name and Organization Identifier must be provided to create the Bundle Identifier that identifies the app in the entire system.
- Select the project storage path and click Create to create a project.
2. Import the SDK
Go to SDK Downloads to download the latest SDK version and decompress the SDK package after the download.
ZEGOCLOUD provides the XCFramework SDK, which includes the ARM64 architecture and does not include the ARMv7 architecture.
Manually copy the SDK dynamic library file ZegoAvatar.xcframework to the project directory.
Open Xcode, select File > Add Files to "xxx" (xxx indicates the project name), and add the SDK Library file to the project.
Select TARGETS > General > Frameworks,Libraries,and Embedded Content, add ZegoAvatar.xcframework, and set Embed to Embed & Sign.
Select TARGETS > Build Settings > Build Options and set Enable Bitcode to NO.
3. Set permissions
Based on actual application needs, set permissions required by the application.
- In Xcode, select TARGETS > Info > Custom iOS Target Properties.
Click the plus icon (+) and add the camera and microphone permissions.
Camera (used for the facial expression mirroring feature):
Privacy - Camera Usage Description
Microphone (used for the speech simulation feature):
Privacy - Microphone Usage Description
Import resource packages
Before using AI capabilities provided by the ZegoAvatar SDK, you need to import the corresponding resource packages. Go to SDK Downloads to obtain the following resource packages.
You can import resource packages using the dynamic downloading
or added from local
method.
Dynamic downloading (Recommended)
Resource name | Description | Package size | Support dynamic downloading |
Recommended download time |
---|---|---|---|---|
AIModel.bundle |
AI model resources of the ZegoAvatar SDK. To use the facial expression mirroring, speech simulation, automatic avatar generation, or other capabilities, you need to transfer the absolute path of the resource to the ZegoAvatar SDK. |
|
Yes |
Download the resource before the ZegoAvatarService SDK is initialized. |
base.bundle |
Aesthetics resources, including the basic 3D human model resources, resource mapping table, and default human model appearance. |
|
Yes |
Download the resource before the ZegoCharacterHelper class is created. |
Packages |
Makeup, widget, accessory, and other resources. |
Each resource is 200 KB to 1 MB in size, depending on the resource complexity. |
Yes |
We recommend that you download the related resources only when you need them to reduce the occupation of the local storage space. |
Packages contain some aesthetic resources. Contact ZEGOCLOUD team
to obtain all aesthetic resources if required.
Added from local
Go to SDK Downloads to obtain related resource packages.
Decompress obtained resource packages, find the assets folder, and drag and drop it to your project.
In the dialog box that appears, select Create folder references to add the folder.
The following figure shows the directory structure after the folder is added.