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 11.0+
- Swift projects must use Swift 4.0 or higher
- Support for iOS 11.0+
インストール
The iOS Voice framework can be installed using Carthage, CocoaPods or manually, as you prefer.
変更
Cartfileに下記の行を追加することで、Programmable Voice for iOSを追加できます:
binary "https://raw.githubusercontent.com/twilio/twilio-voice-ios/Releases/twilio-voice-ios.json"
続いて、carthage bootstrap
を実行します。 (SDKを更新している場合は carthage update
)
アプリケーションターゲットの「General」タブ、「Linked Frameworks and Libraries」セクションで、ディスク上の Carthage/Build フォルダーから使用したいフレームワークをドラッグ&ドロップします。
アプリケーションターゲットの「Build Phases」設定タブで、「+」アイコンをクリックして「New Run Script Phase」を選択します。 シェル (/bin/sh
など) を指定するRun Scriptを作成し、シェルの下部のスクリプトエリアに下記の内容を追加します:
/usr/local/bin/carthage copy-frameworks
「Input Files」の下側に使用したいフレームワークへのパスを追加します。 例:
$(SRCROOT)/Carthage/Build/iOS/TwilioVoice.framework
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.1.0' end
そして、pod install --verbose
を実行してプロジェクトに依存関係をインストールします。
手動インストール
Voiceは既存のプロジェクトにドラッグ&ドロップ可能なダイナミックiOSフレームワークとして配布されています。
フレームワークをダウンロード、展開したら、XcodeプロジェクトのGeneral 設定ページに移動します。 Embedded Binariesセクションに、TwilioVoice.framework
をドラッグ&ドロップします。 "Copy items if needed"にチェックが入っているかどうか確認し、Finishをクリックします。 これで、LibrariesセクションのEmbedded BinariesおよびLinked Frameworks双方に TwilioVoice.framework
が追加されました。 -ObjC
をAppのProject SettingsでOther Linker Flagsに追加することも必要です。
Appを App Storeで配信する前に、埋め込み済みフレームワークからシミュレーターのバイナリーを取り除くことが必要です。 (Xcodeプロジェクト)ターゲットのBuild Phases画面に移動し、新規の "Run Script Phase" を作成します。 下記コマンドを、スクリプトのテキスト・フィールドにペーストします。
/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.
静的ライブラリー
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タグのついた情報から欲しいものを探してみましょう。