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?

Twilio Client iOS Quickstart

The Twilio Client SDKs for Android & iOS have been deprecated and replaced by Twilio's new Programmable Voice SDK. The Programmable Voice SDK offers many improvements over the Twilio Client SDK, including greater stability, improved backgrounding, and built-in support for push notifications for incoming calls.

Get started with the new Programmable Voice SDK by checking out one of the links below:
* Programmable Voice SDK for Android Quickstart
* Programmable Voice SDK for iOS: Objective-C Quickstart
* Programmable Voice SDK for iOS: Swift Quickstart

If you're just getting started with a Twilio mobile application for voice calling, we recommend you use the Programmable Voice SDK. If you're already using the Twilio Client SDK, you should plan to upgrade to the Programmable Voice SDK as soon as you're able.

Table Of Contents

Gather Twlio Account Information

The first thing we need to do is grab all the necessary information from our Twilio account. To set up our back-end for Twilio Client, we will need four values from our account:

Config Value Description
Account SID Your primary Twilio account identifier - find this in the console here.
Auth Token Used to authenticate - just like the above, you'll find this here.
TwiML App SID The TwiML application with a voice URL configured to access your server running this app - create one in the console here. Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running.
Twilio Phone # A Twilio phone number in E.164 format - you can get one here

Download, Configure, and Run the Starter App

Choose a download package for your server-side language of choice. If you're primarily a mobile app developer without a strong preference, Node.js or Ruby will probably get you up and running the fastest.

Follow the instructions in the README for each starter application to configure and run it on your machine, using the four values we created above:

Expose Your Server to the World

Once you've got your server up and running, you will need to host it somewhere Twilio can access it. You can either publish your app with a web hosting provider, or you can run it locally and use something like ngrok to create a tunnel to your development machine with a publicly accessible URL.

See the README above for the specific ngrok instructions for your preferred platform.

Configure Your TwiML App

Now, configure the Voice REQUEST URL on your TwiML App to hit the voice URL on your server. (Again, see the README above for platform-specific instructions.)


Explore the Server Starter Application

This is where the fun begins! When you visit the homepage of the starter application, you should see a page which looks like this:


You have been assigned a random client name and are ready to make phone calls. You can type in a phone number to make a call, or you can type in the client name of another user. Try opening the web application in another browser window and call yourself. Echo...echo...echo.

While all of this is great (and we can use it to test the iOS app) - you're a mobile app developer, right? Let's get straight to some iOS code!

Download the iOS App

You will need XCode to run the starter iOS application, but you won't need your own iPhone or iPad - this app will also run on the simulator. Of course, running on your own device is more fun, and gives you better insight into how your final application will work in the real world.

We have two choices of client languages - Swift and Objective-C. If you're just getting started with iOS application development, we recommend starting with Swift.

Download the project now.

Note that these projects don't come prepackaged with the Twilio Client SDK for iOS, so you'll have to install it. We recommend setting up Cocoapods and using that to install the SDK:

pod install

You can also download the SDK and manually install the libraries and headers into your project.

One more thing you'll need to do before you run the application - you'll need to change the URL for capability tokens that the app uses to authorize itself with Twilio. This URL is going to be related to the server application you installed above - if you haven't done that step, and deployed the application to a web host or created an external URL with ngrok, go ahead and do that now.

After that, go ahead and find this constant, TOKEN_URL, in DialViewController.swift (or DialViewController.m), and change it to your token location.

let TOKEN_URL = ""

Explore the iOS App

We've kept the iOS quickstart app pretty simple! All of the code you'll be interested in is in the DialViewController class. After the view controller loads, we retrieve the capability token from your server, initialize a Twilio Client Device (TCDevice), and then wait for incoming connections (for instance, from the web app).

Twilio Client iOS Quickstart App

You can also connect to either a named client (like the web app), or a phone number (like your own)! Go ahead and call yourself from your app, it'll be fun!

Get Help

Need some extra help? Tweet us or contact support and we'll make sure to get you running quickly. Have fun with Twilio Client, and make sure to let us know what you're building!

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...