Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

iOS SDK

Twilio Programmable Voice SDK for iOS allows you to add voice-over-IP (VoIP) calling into your native iOS applications.

For step-by-step instructions to get up and running with the iOS SDK for Programmable Voice, check out the quickstarts for making calls from your native iOS apps in Objective-C and Swift.

The Programmable Voice SDKs are released according to semantic versioning, so you should always note both the major and minor versions of the SDKs to maintain API compatibility with your code. For versions 1.0 and higher, minor versions will not break existing integrations, but during a beta period, minor version increments in the 0.x range represent breaking API changes. Patch level releases - 0.0.x - represent non-breaking changes during a beta.

Authentication/Authorization

In the Programmable Voice SDKs we use a new authentication/authorization mechanism for your application server to give your clients access to your voice applications. This is done by providing your app an Access Token, which governs the client application’s authentication session with your account in the Twilio cloud. Access Tokens are different from the Capability Tokens used in the previous versions of Twilio Client. Using a Capability Token in the Programmable Voice SDK will not work. Access Tokens, just like Capability Tokens before, are JWT tokens, but are using a new, more flexible format that is used across all the new Twilio SDKs.

Management Console

Developer tools and configuration options for Programmable Voice can be found in the Programmable Voice Dashboard. Use the console to create TwiML apps, update push credentials, view logs, and much more.

The Programmable Voice SDKs are released according to semantic versioning, so you should always note both the major and minor versions of the SDKs to maintain API compatibility with your code. For versions 1.0 and higher, minor versions will not break existing integrations, but during a beta period, minor version increments in the 0.x range represent breaking API changes. Patch level releases - 0.0.x - represent non-breaking changes during a beta.

System Requirements

The Twilio Programmable Voice SDK is supported on iOS 8.1 or above.

We support the following devices and device families:

  • iPhone 4s and up
  • iPod touch 5G and up
  • iPad 4th gen and up

The Quickstart demo apps are built for Xcode 8 and iOS 10, and require Cocoapods 1.0 or greater.

Install

The iOS Voice framework can be installed using Carthage, Cocoapods or manually, as you prefer.

Carthage

You can add Programmable Voice for iOS by adding the following line to your Cartfile:

github "twilio/twilio-voice-ios"

Then run carthage bootstrap (or carthage update if you are updating your SDKs)

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

Add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/TwilioVoice.framework

Cocoapods

It's easy to install the Voice framework if you manage your dependencies using Cocoapods. Simply add the following to your Podfile:

2.x:

source 'https://github.com/cocoapods/specs'

target 'TARGET_NAME' do
  use_frameworks!

  pod 'TwilioVoice', '~> 2.0'
end

3.x:

source 'https://github.com/cocoapods/specs'

target 'TARGET_NAME' do
  use_frameworks!

  pod 'TwilioVoice', '3.0.0-beta2'
end

Then run pod install --verbose to install the dependencies to your project.

Manual Install

Voice is distributed as a dynamic iOS framework that you can drag and drop into your existing projects.

Once you've downloaded and unpacked the framework, navigate to your Xcode project's General settings page. Drag and drop TwilioVoice.framework onto the Embedded Binaries section. Ensure that "Copy items if needed" is checked and press Finish. This will add TwilioVoice.framework to both the Embedded Binaries and Linked Frameworks and Libraries sections. You'll also need to add -ObjC to the Other Linker Flags in your app project settings.

Before distributing your app to the  App Store, you will need to strip the simulator binaries from the embedded framework. Navigate to your target's Build Phases screen and create a new "Run Script Phase". Paste the following command in the script text field:

/bin/bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/TwilioVoice.framework/remove_archs"

We recommend that you start with our Getting Started guide to get a sense of how all these components fit together. The Quickstart app is set up to manage dependencies with Cocoapods, but you can also install the frameworks manually, as described above.

Static Library

Voice is also available as a static library.

Once you've downloaded the static library, drag and drop the libTwilioVoice.a, libboringssl.a and the include folder into your Xcode project. This will add static library to the Linked Frameworks and Libraries section.

There are a few more things you'll have to add to make the library build with your app:

  • Add -ObjC to the Other Linker Flags
  • Add these frameworks to the Linked Frameworks and Libraries section: SystemConfiguration, AudioToolbox, AVFoundation, CoreTelephony, PushKit and CallKit.

Getting Help

We are anxious to hear your feedback and help you with any trouble you may encounter. For technical support, file a ticket with our support team or send an email to help@twilio.com.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

Loading Code Sample...