This page contains information on how to prepare the development environment before enabling a call/live broadcast with the Agora SDK for iOS.
Development environment:
Use a physical device to run the sample. Emulators may lack the functionality or the performance needed to run the sample.
Choose one of the following methods to add the Agora SDK libraries to your project:
Install CocoaPods by running the following command in Terminal:
brew install cocoapods
- Skip this step if you have preconfigured CocoaPods and Homebrew on your system.
- If you see
-bash: brew: command not found
in Terminal, install Homebrew before running the command. See Homebrew Installation Method.
Create a Podfile in your project. In the root directory of your project, run the following command in Terminal. This creates a Podfile in the same directory.
pod init
Add the Agora SDK reference in the Podfile. Open the Podfile, and put in the following content. Fill “Your App” with the name of your Target.
platform :ios, '9.0'
use_frameworks!
target 'Your App' do
pod 'AgoraRtcEngine_iOS'
end
Update the local Cocoapods library. Run the following command in Terminal:
pod update
Install the related libraries.
pod install
If you see Pod installation complete!
in Terminal, you have successfully added the libraries. Click to open the YourApp.xcworkspace
file, or run the following command to open it. Fill “YourApp” with the name of your Target.
open YourApp.xcworkspace
Download the Agora Video SDK for iOS and extract the files from the downloaded SDK package.
Open your project with Xcode and select the current Target.
Navigate to the Build Phases tab. Expand the Link Binary with Libraries section to add the following libraries. To begin adding the new libraries, click the + button.
AgoraRtcEngineKit.framework
Accelerate.framework
SystemConfiguration.framework
libc++.tbd
libresolv.tbd
CoreMedia.framework
VideoToolbox.framework
AudioToolbox.framework
CoreTelephony.framework
AVFoundation.framework
CoreML.framework
AgoraRtcEngineKit.framework
is in the libs folder of the downloaded SDK. Click + > Add Other…, go to the downloaded SDK, and add AgoraRtcEngineKit.framework
.
Set the dependency of
CoreML.framework
as Optional in Xcode if your device runs iOS 9 or before.
Before enabling a video call, you need to enable camera and microphone access to the SDK on your device. Open info.plist
and click + to add:
Before:
After:
You can access the added library using Objective-C or Swift.
In the main file that uses the Agora APIs, add #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
.
The SDK provides FAT image libraries with multi-architecture support for both 32/64-bit audio emulators and 32/64-bit audio/video real devices.
In the main file that uses the Agora APIs, add import AgoraRtcEngineKit
.
The Agora SDK provides the following additional settings and permissions for you to optimize your project:
Set the Background Modes. When the background mode is enabled, your application can still run the video call when it is switched to the background. Select the current Target, click the Capabilities tab, enable Background Modes, and check Audio, AirPlay, and Picture in Picture.
Enable or disable Bitcode. Applications developed with Bitcode can be optimized once it is uploaded to the App Store. Select the current Target, click the Build Settings tab, and enable or disable Bitcode according to your needs.
You have set up the iOS environment and can start a call/live broadcast following the steps under Quickstart Guide: