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.
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.
認証と権限付与
Programmable Voice SDKでは、音声アプリケーションにおいて開発者のアプリケーション・サーバーがクライアントのアクセスを許可するための新しい認証と権限付与の仕組みを使用しています。 これはアプリケーションに、Twilioクラウド上の開発者のアカウントでクライアント・アプリケーションの認証セッションを管理するアクセス・トークンを提供することで行われます。 アクセス・トークンはTwilioクライアントの旧バージョンで使用されていたケイパビリティ・トークンとは異なるものです。 ケイパビリティ・トークンは、Programmable Voice SDKでは動作しません。 アクセストークンは旧ケイパビリティ・トークン同様のJWTトークンですが、最新のTwilio SDK全体に渡って使用される、新しくより柔軟性に富んだ形式を使用しています。
管理コンソール
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.
前提条件
- Xcode 12.0+
- Swift projects must use Swift 4.0 or higher
- Support for iOS 11.0+
インストール
The iOS Voice framework can be installed using Swift Package Manager, CocoaPods or manually, as you prefer.
Swift Package Manager
You can add Programmable Voice for iOS 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 include -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
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', '~> 6.2.1' end
そして、pod install --verbose
を実行してプロジェクトに依存関係をインストールします。
手動インストール
TwilioVoice.xcframework
は既存のプロジェクトにドラッグ&ドロップできる動的なiOSフレームワークとして配布されています。
Once you've downloaded and unpacked the XCFramework, navigate to your Xcode project's General settings page. Drag and drop TwilioVoice.xcframework
onto the Frameworks, Libraries, and Embedded Content section. Ensure that "Copy items if needed" is checked and press Finish. Ensure that "Embed & Sign" is selected.
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 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 here. Once Carthage supports binary .xcframeworks
, Carthage distribution will be re-added.
静的ライブラリー
Voiceも静的ライブラリーとして利用可能です。
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 the static libraries to the Frameworks, Libraries, and Embedded Contents section.
Appでライブラリーをビルドできるようにするには、追加で下記のものが必要になります:
- Other Linker Flagsに
-ObjC
を追加します - 下記のフレームワークをLinked Frameworks and Librariesセクションに追加します:
SystemConfiguration
、AudioToolbox
、AVFoundation
、CoreTelephony
、PushKit
、およびCallKit
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。