メニュー

Expand
ページを評価:

iOS SDK

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

iOS 14 Compatibility Notice

For iOS 14 compatibility, please upgrade to the latest Voice iOS 5.5.1 SDK.

iOS 13 Compatibility Notice

Apps using versions 2.0.x, 3.x, and 4.x may fail to register for incoming calls when running on iOS 13. We recommend you upgrade to 5.0 release. Please refer to this advisory and this GitHub issue for more information. Check our migration guides when planning your migration to our latest SDK.

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.

仕組み

Mobile Voice SDK Diagram: Your mobile app connects to Twilio, Twilio sends a webhook to your backend to get TwiML instructions, Twilio then executes those instructions (e.g. makes a phone call).

  1. You connect to Twilio from your mobile app with the Voice SDK
  2. Twilio sends you a webhook to get the TwiML instructions
  3. Your backend responds to Twilio with TwiML instructions
    • For example, you can instruct Twilio to call a number, call a VoIP endpoint, or connect to a conference.
    • E.g. To connect to a phone number, your backend would return <Dial callerId="+155512345678"><Number>+155587654321</Number></Dial>
  4. Twilio executes your TwiML instructions (e.g. Dials the number in your TwiML instructions)
  5. Twilio creates a VoIP connection between your callee and your mobile app

Versioning

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.

認証と権限付与

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 of the new Twilio SDKs.

管理コンソール

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.

インストール

前提条件

  • Xcode 12.0+
  • Swift projects must use Swift 4.0 or higher
  • Support for iOS 11.0+

インストール

The iOS Voice SDK can be installed using Swift Package Manager, CocoaPods, or manually.

Swift Package Manager

You can add the iOS Voice SDK by adding the https://github.com/twilio/twilio-voice-ios repository as a Swift Package.

In your Build Settings, you will also need to modify Other Linker Flags to inlcude -ObjC.

As of the latest release of Xcode (currently 12.4), there is a known issue with consuming binary frameworks distributed via Swift Package Manager. The current workaround to this issue is to add a Run Script Phase to the Build Phases of your Xcode project. This Run Script Phase should come after the Embed Frameworks build phase. This new Run Script Phase should contain the following code:

find "${CODESIGNING_FOLDER_PATH}" -name '*.framework' -print0 | while read -d $'\0' framework
do
    codesign --force --deep --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements --timestamp=none "${framework}"
done

CocoaPod

Add the following to your Podfile:

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

target 'TARGET_NAME' do
  use_frameworks!

  pod 'TwilioVoice', '~> 6.3.0'
end

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

手動インストール

TwilioVoice.xcframework は既存のプロジェクトにドラッグ&ドロップできる動的なiOSフレームワークとして配布されています。

  1. Download the Voice framework here
  2. Once you've downloaded and unpacked the XCFramework, navigate to your Xcode project's General settings page.
  3. Drag and drop TwilioVoice.xcframework onto the Frameworks, Libraries, and Embedded Content section.
  4. Ensure that "Copy items if needed" is checked and press Finish.
  5. Ensure that "Embed & Sign" is selected.
  6. In your Build Settings, you will also need to modify Other Linker Flags to include -ObjC.

We recommend that you start with our Getting Started guide to get a sense of how all of 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.

変更

Carthage is not currently a supported distribution mechanism for Twilio Voice. Carthage does not currently work with .xcframeworks as documented in Carthage's GitHub Issues. Once Carthage supports binary .xcframeworks, Carthage distribution will be re-added.

静的ライブラリー

Voiceも静的ライブラリーとして利用可能です。

  1. Download the Voice static library from GitHub
  2. Drag and drop the libTwilioVoice.a, libboringssl.a, and the include folder into your Xcode project.
    • This will add the static libraries to the Frameworks, Libraries, and Embedded Contents section.
  3. Add -ObjC to the Other Linker Flags
  4. Add the following frameworks to the Linked Frameworks and Libraries section:
    • SystemConfiguration
    • AudioToolbox
    • AVFoundation
    • CoreTelephony
    • PushKit
    • CallKitについて参照
ページを評価:

ヘルプが必要ですか?

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

        
        
        

        フィードバックくださりありがとうございます!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        ステップ1

        Get link

        Get a free personal referral link here

        ステップ2:

        Give $10

        Your user signs up and upgrade using link

        ステップ3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more