iOS SDK

Twilio's Programmable Voice SDK includes client-side SDKs for browser-based web applications and native mobile applications.

The 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:

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

target 'TARGET_NAME' do
  use_frameworks!

  pod 'TwilioVoice', '~> 2.0'
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 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.

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.