This page contains information on how to prepare the development environment before enabling a voice call with the Agora SDK for iOS.
- Xcode 9.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 have opened the ports and whitelisted the domains as specified in Firewall Requirements.
Use a physical device to run the sample. Simulators may lack the functionality or performance needed to run the sample.
Create an Agora Account and Get an App ID
Sign up for a developer account at https://dashboard.agora.io/.
Click Add New Project on the Projects page of Dashboard.
Fill in the Project Name and click Submit. You have created your first project at Agora.
Find the 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 Terminal says
-bash: brew: command not found, 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 Terminal says
Pod installation complete!, 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
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 now 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