This page contains information on how to prepare the development environment before enabling a voice call with the Agora SDK for iOS.
- Xcode 10.0+.
- Physical iOS device 8.0+ (iPhone or iPad).
- Ensure that your project has a validated provisioning profile certificate.
- Before accessing Agora’s services, ensure that you open the ports and whitelist the domains specified in Firewall Requirements.
Use a physical device to run the sample. Emulators may lack the functionality or performance needed to run the sample.
Create an Agora Project and Get an App ID
- Sign up for a developer account at Agora Dashboard and follow the on-screen instructions to create a project.
- Click the Project Management icon in the left navigation panel.
- Find the corresponding App ID under the created project.
Add the Agora SDK to Your Project
Choose one of the following methods to add the Agora SDK libraries to your project:
- Adding the Libraries Automatically: Add the libraries automatically using CocoaPods. You do not need to download the SDK.
- Adding the Libraries Manually: Download the SDK and add the libraries manually.
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 foundin 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.
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:
Install the related libraries.
If you see
Pod installation complete!in Terminal, you have successfully added the libraries. Click to open the
YourApp.xcworkspacefile, or run the following command to open it. Fill “YourApp” with the name of your Target.
Download the Agora Voice SDK for iOS and unzip 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.
AgoraAudioKit.frameworkis in the libs folder of the downloaded SDK. Click + > Add Other…, go to the downloaded SDK, and add
Set the dependency of
CoreML.frameworkas Optional in Xcode if your device runs iOS 9 or before.
Authorize the Use of the Agora SDK
Before enabling a voice call, you need to enable microphone access to the SDK on your device. Open
info.plist and click + to add:
Privacy - Microphone Usage Description, and add a note in the Value column.
Access the Library
In the main file that uses the Agora APIs, add #import <AgoraAudioKit/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
Additional Settings and Permissions
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 voice 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:
- Initialize the SDK
- Join a Channel
- Publish and Subscribe to Streams