iOS

更新时间:
复制 MD 格式

This topic describes how to integrate the Real-Time Communication SDK for iOS.

Prerequisites

  • The latest version of Xcode is installed. For more information, see Xcode.

  • You need an Apple developer certificate or a personal account.

Environment requirements

Type

Description

Device

iPhone 5s and later physical devices.

System version

iOS 12 and later.

Integrate using CocoaPods

Important

Make sure that the Ruby environment is installed on your Mac.

  1. Open a terminal window.

  2. Install CocoaPods.

    sudo gem install cocoapods

  3. Create a Podfile.

    Go to the project path and run the following command to create a Podfile.

    pod init

  4. Edit the Podfile.

platform :ios, '12.0'
target 'DingRTCSample' do
    # Integrate the full SDK
    pod 'DingRTC_iOS', '3.6.1'
    
    # Selectively integrate base libraries and specified dynamic libraries from the full SDK
    pod 'DingRTC_iOS', '3.6.1', :subspecs => ['RtcBasic', 'AudioEnhance', 'FaceBeauty']
end          
Note

The pod version number is for reference only. For the latest pod version number, see SDK download.

Starting from version 3.6.1, you can use subspecs to integrate specific dynamic libraries. For information about the supported subspecs modules, see the podspec file for the corresponding version.

  1. Install the SDK.

    pod install

    After you run the command, an *.xcworkspace file is generated. This indicates that the SDK is successfully integrated.

  2. Follow Steps 5 and 6 of manual integration to complete the project settings.

Integrate manually

  1. Download and decompress the iOS SDK. For the download link, see SDK download.

  2. Create a new project and copy the decompressed SDK files to the project folder.

  3. On the General tab, add the DingRTC.framework or DingRTC.xcframework file and any specific dynamic module libraries from the SDK to your project, and then select Embed & Sign.

    The SDK package contains the following folders:

    • Release-iphoneall folder: Contains files for both physical devices and emulators. You can use either the xcframework or framework format. The xcframework format is recommended.

    • Release-iphoneos folder: For physical devices.

    • Release-iphonesimulator folder: For emulators.

  1. On the Build Phases tab, add the following system dependencies.

  • CoreMedia.framework

  • AVFoundation.framework

  • AudioToolbox.framework

  • VideoToolbox.framework

  • ReplayKit.framework

  1. On the Signing & Capabilities tab, add the Background Modes capability and enable the background audio permission.

Note

To prevent calls from being interrupted when the application is in the background, you must enable the background audio permission. By default, the SDK continues to push the audio stream when the application is running in the background.

  1. Edit the info.plist file to add camera and microphone permissions.

  1. Connect a device using Xcode and press Command+B. If the interface displays Build Success, the SDK is successfully integrated.

What to do next

After integrating the SDK, you can implement the basic features of Real-Time Communication. For more information, see Implement basic features.