ios-sdk
Skill2 starsChanged 8 months agoMITView on GitHub
Twilio development skill: ios-sdk
- Reads credentials
In this repository66 other files it gives its agents.
- adversarial-reviewSkill
- agent-connectSkill
- agent-teams-guideSkill
- agent-testingSkill
- android-sdkSkill
- brainstormSkill
- branded-callingSkill
- callbacksSkill
- compliance-regulatorySkill
- conferenceSkill
- context-engineeringSkill
- context-hubSkill
- conversational-intelligenceSkill
- conversation-relay-referenceSkill
- conversation-relaySkill
- conversationrelaySkill
- conversations-v2Skill
- customer-memorySkill
- deepgramSkill
- deep-validationSkill
- elastic-sip-trunkingSkill
- env-doctorSkill
- event-streamsSkill
- getting-startedSkill
- hooks-referenceSkill
- iamSkill
- ivr-crawlerSkill
- ivr-migratorSkill
- lookupSkill
- media-streamsSkill
- memory-systemsSkill
- messaging-services-referenceSkill
- messaging-servicesSkill
- messagingSkill
- multi-agent-patternsSkill
- operational-gotchasSkill
- paymentsSkill
- paySkill
- phone-numbersSkill
- proxySkill
- real-time-transcriptionSkill
- recordingsSkill
- segmentSkill
- sendgrid-emailSkill
- sip-byocSkill
- sipSkill
- sync-referenceSkill
- syncSkill
- taskrouter-referenceSkill
- taskrouterSkill
- tdd-workflowSkill
- tool-boundariesSkill
- twilio-cliSkill
- twilio-invariantsSkill
- verify-referenceSkill
- verifySkill
- video-patternsSkill
- videoSkill
- voice-insightsSkill
- voice-referenceSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 3 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 148
Call TwilioVoiceSDK.handleNotification(payload, delegate: self) → receives TVOCallInvite
- Very specific: line 152
Call action.fulfill() after accepting
- Very specific: line 156
Create CXStartCallAction with UUID and handle
- Very specific: line 159
Call action.fulfill() after callDidConnect fires
- Distinctive: line 175
Read references/callkit-pushkit.md for the complete PushKit setup, certificate creation, and push credential registration.
- Distinctive: line 185
Sandbox vs production push credentials: Create separate Twilio push credentials (CRxxxxx) for development (sandbox) and production (App …
- Very specific: line 193
Video SDK needs
NSLocalNetworkUsageDescriptionon iOS 14+: Only required if using peer-to-peer rooms with … - Very specific: line 195
Xcode 26 requires separate iOS platform download: Run xcodebuild -downloadPlatform iOS or Xcode > Settings > Components.
- Very specific: line 201
CallKit audio session activation timing: Do NOT play or record audio before CallKit calls provider(_:didActivate:).
- Very specific: line 203
TVOCallInvitemust be retained until call completes: If the invite object is deallocated while the call is active, the SDK crashes (fixed … - Very specific: line 205
AVAudioSessionCategoryOptionAllowBluetoothis deprecated: Use .allowBluetoothHFP instead. - Distinctive: line 207
Token refresh must happen before expiry: If the token expires mid-session, existing calls continue but new calls and registrations fail …
- Very specific: line 223
Edge selection matters for mobile: Default roaming works globally but adds a negotiation round-trip.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
name: ios-sdk description: Twilio iOS SDK development guide (Voice + Video). Use when building native iOS calling apps, video conferencing, CallKit integration, VoIP push notifications, or debugging iOS-specific platform issues.
iOS SDK Development Skill
iOS-specific platform guide for building native apps with Twilio Voice SDK 6.x and Video SDK 5.x. Load this skill when working on Swift/Objective-C code that integrates Twilio SDKs, or when debugging iOS-specific issues like CallKit, PushKit, background modes, or audio session conflicts. Medium degree of freedom — preferred patterns exist but vary by app architecture.
Evidence date: 2026-03-29. Account: ACxx...xx SDK versions: Voice 6.13.6, Video 5.11.2.
Scope
CAN
- Guide native iOS app development with Twilio Voice SDK (PSTN calling, client-to-client)
- Guide native iOS app development with Twilio Video SDK (group rooms, tracks, recording)
- Configure CallKit for native call UI integration (incoming and outgoing)
- Set up VoIP push notifications via PushKit for backgrounded incoming calls
- Handle iOS audio session management (categories, modes, interruptions, routing)
- Handle iOS permission flows (microphone, camera, local network)
- Generate server-side AccessTokens with Voice and Video grants for iOS clients
- Debug iOS-specific issues (audio routing, background mode, push registration)
- Advise on app lifecycle concerns (foreground, background, suspended, terminated)
CANNOT
- Build or compile iOS apps — This skill advises on patterns; Xcode is required to build
- Test on iOS simulator for media — Simulator has no camera; microphone support is limited
- Use Elastic SIP Trunking from iOS SDK — SDKs connect via Programmable Voice only
- Record client-side — All recording is server-side via TwiML or Calls API
- Run without a server-side token endpoint — iOS SDK requires AccessToken JWT from your backend
- Use Video SDK without API Key auth — Video AccessTokens require API Key + Secret, not Auth Token
- Receive VoIP pushes without CallKit on iOS 13+ — Apple requires
reportNewIncomingCallinside PushKit callback; without it, the system terminates your app - Share screen on iOS via Video SDK without ReplayKit — Screen capture requires a Broadcast Upload Extension
- Use Carthage with Video SDK — Carthage does not support
.xcframeworks - Mix ConversationRelay WebSocket with iOS Voice SDK — ConversationRelay connects a PSTN call to a WebSocket server, not an SDK client; the iOS SDK connects via WebRTC
Quick Decision
| Need | Use | Why |
| Native iOS calling app with system call UI | Voice SDK + CallKit | CallKit gives lock screen UI, call history, Siri integration |
| Video conferencing in iOS app | Video SDK (group rooms) | Server-routed media, up to 50 participants, recording support |
| Cross-platform mobile app | React Native SDK | Single codebase bridging to native iOS/Android SDKs |
| Voice AI agent callable from phone | ConversationRelay (not iOS SDK) | AI connects via WebSocket to PSTN call; no native SDK needed |
| Browser-based calling on iOS Safari | JavaScript SDK | No app install; works in Safari with HTTPS |
| PSTN calling without native app | Calls API | Server-to-server; no client SDK involved |
Decision Frameworks
Voice SDK vs ConversationRelay on Mobile
| Factor | Voice SDK | ConversationRelay |
| User experience | Native app with CallKit UI | User calls a phone number (PSTN) |
| Network | WebRTC (SDK manages) | PSTN carrier network |
| Requires app install | Yes | No |
| Background reception | VoIP push + CallKit | N/A (it's a phone call) |
| Custom audio processing | Yes (TVOAudioDevice) | No (server-side STT/TTS) |
| Use case | Softphone, contact center agent | AI voice agent, IVR replacement |
Installation Method
| Method | Voice SDK | Video SDK | Notes |
| Swift Package Manager | Preferred | Preferred | Add GitHub repo URL in Xcode |
| CocoaPods | Supported | Supported | pod 'TwilioVoice', '~> 6.13' / pod 'TwilioVideo', '~> 5.11' |
| Manual XCFramework | Supported | Supported | Download from GitHub releases, embed & sign |
| Carthage | N/A | Not supported | Carthage does not support .xcframeworks |
Static vs Dynamic Framework
| Factor | Dynamic | Static |
| App launch time | Slightly slower (dylib loading) | Faster (linked at build) |
| Binary size | Smaller app, separate framework | Larger app, single binary |
| Voice SDK name | TwilioVoice | TwilioVoice-static |
| Extra setup | None | Add SystemConfiguration.framework |
| Linker flag | None | Add -ObjC to Other Linker Flags |
Audio Session Category for Voice vs Video
| Use Case | Category | Mode | Options |
| Voice call (default) | .playAndRecord | .voiceChat | SDK manages automatically |
| Video call (default) | .playAndRecord | .videoChat | SDK manages automatically |
| Voice + Bluetooth | .playAndRecord | .voiceChat | .allowBluetoothHFP (not .allowBluetooth — deprecated for Xcode 26+) |
| Voice + speaker | .playAndRecord | .voiceChat | .defaultToSpeaker |
Server-Side Token Endpoint
iOS apps need a backend endpoint that generates AccessTokens. This is the same for all platforms — see the Voice SDKs skill for the canonical token generation code.
Key iOS-specific token considerations:
- Push credential SID in Voice grant: Include
pushCredentialSid: 'CRxxxxx'to enable VoIP push registration - Identity is required: Token generation throws if identity is omitted. Identity is case-sensitive and preserved exactly.
- Separate tokens for Voice and Video: While a single token CAN carry both grants, use separate tokens per SDK to simplify TTL management and grant rotation
- TTL for mobile: 1-4 hours recommended. Max is 86400s (24h). Implement proactive refresh at ~75% TTL.
// ABOUTME: Voice AccessToken with push credential for iOS VoIP push registration.
// ABOUTME: The pushCredentialSid enables TwilioVoiceSDK.register() to bind the device token.
const voiceGrant = new VoiceGrant({
outgoingApplicationSid: process.env.TWIML_APP_SID,
incomingAllow: true,
pushCredentialSid: process.env.PUSH_CREDENTIAL_SID // CRxxxxx
});CallKit Integration
CallKit provides the native iOS call UI (lock screen, call history, Siri). It is mandatory for VoIP push on iOS 13+.
Provider Configuration
let config = CXProviderConfiguration()
config.maximumCallGroups = 1
config.maximumCallsPerCallGroup = 1
config.supportsVideo = false
config.supportedHandleTypes = [.phoneNumber, .generic]
// Optional: config.iconTemplateImageData for custom icon
let provider = CXProvider(configuration: config)
provider.setDelegate(self, queue: nil) // nil = main queueIncoming Call Flow (PushKit → CallKit → Answer)
- PushKit delivers VoIP push →
pushRegistry(_:didReceiveIncomingPushWith:for:completion:) - Call
TwilioVoiceSDK.handleNotification(payload, delegate: self)→ receivesTVOCallInvite - Report to CallKit:
provider.reportNewIncomingCall(with: uuid, update: update)— this MUST happen inside the PushKit callback on iOS 13+ - User taps Answer →
provider(_:perform: CXAnswerCallAction)fires - Accept invite:
callInvite.accept(with: delegate)→ returnsTVOCall - Call
action.fulfill()after accepting
Outgoing Call Flow (CallKit → Connect)
- Create
CXStartCallActionwith UUID and handle - Request via
CXCallController().request(CXTransaction(action:)) - In
provider(_:perform: CXStartCallAction), callTwilioVoiceSDK.connect(options:delegate:) - Call
action.fulfill()aftercallDidConnectfires
Audio Session Activation
CallKit manages the audio session lifecycle. The SDK needs to know when audio is activated:
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
TwilioVoiceSDK.audioDevice.isEnabled = true
}
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
TwilioVoiceSDK.audioDevice.isEnabled = false
}Read references/callkit-pushkit.md for the complete PushKit setup, certificate creation, and push credential registration.
Gotchas
Setup
- VoIP push requires CallKit on iOS 13+: Apple mandates that
reportNewIncomingCallis called inside the PushKit push handler. If you don't, Apple terminates your app and may stop delivering pushes entirely. There is no workaround — CallKit is not optional for VoIP push. - Sandbox vs production push credentials: Create separate Twilio push credentials (CRxxxxx) for development (sandbox) and production (App Store) builds. Twilio recommends using separate accounts or subaccounts for this. Mixing them causes silent push delivery failures.
-ObjClinker flag for manual/static installs: Without this flag in "Other Linker Flags", category methods in the SDK won't load, causing cryptic runtime crashes (unrecognized selector) that don't appear at compile time.UIBackgroundModesmust includevoip: Without this Info.plist entry, PushKit won't deliver VoIP pushes when the app is backgrounded. This is the most common "incoming calls work in foreground but not background" issue.NSMicrophoneUsageDescriptionis mandatory for Voice: iOS terminates the app without warning if you access the microphone without this Info.plist key. For Video, also addNSCameraUsageDescription.- Video SDK needs
NSLocalNetworkUsageDescriptionon iOS 14+: Only required if using peer-to-peer rooms withTVILocalNetworkPrivacyPolicyAllowAll. Group rooms don't need this. - Xcode 26 requires separate iOS platform download: Run
xcodebuild -downloadPlatform iOSor Xcode > Settings > Components. Without this,xcodebuildcan't find any iOS Simulator destinations even though runtimes exist. - SPM can't build iOS app targets directly:
swift build --sdk iphonesimulatordoesn't work for app targets. Usexcodegento generate.xcodeprojfromproject.yml, thenxcodebuildwith the generated project.
Runtime
- CallKit audio session activation timing: Do NOT play or record audio before CallKit calls
provider(_:didActivate:). The SDK'saudioDevice.isEnabledmust be set totrueonly in thedidActivatecallback. Setting it too early produces silence or crashes. TVOCallInvitemust be retained until call completes: If the invite object is deallocated while the call is active, the SDK crashes (fixed partially in 6.13.5, but retain the object as best practice). Store it in a property, not a local variable.AVAudioSessionCategoryOptionAllowBluetoothis deprecated: Use.allowBluetoothHFPinstead. The old option triggers a deprecation warning in Xcode 26+ builds (Voice SDK 6.13.3+).- Token refresh must happen before expiry: If the token expires mid-session, existing calls continue but new calls and registrations fail silently. Implement a timer at 75% of TTL to fetch a fresh token and re-register.
- Identity is case-sensitive across the system:
<Dial><Client>agent-Alice</Client></Dial>will NOT ring a client registered asagent-alice. This applies to push registration, token generation, and TwiML routing. - Video SDK simulator has no camera:
TVICameraSourcereturns nil on simulator. Test video with a physical device. Audio works on some simulators but is unreliable. TVOCallMessageBuilder.contentTypehas no effect in 6.11.x: Defaults toapplication/jsonregardless of what you set. Fixed tracking but not resolved as of 6.13.x. Use JSON format for call messages.- Voice SDK
getStatsreturns array, not flat object:call.getStats { reports in }returns[StatsReport], each withremoteAudioTrackStatscontaining jitter/MOS/packetsLost. NotgetStatsReportand not a single callback with a flat stats object.
Network
- Reconnection is automatic but app must handle UI: Voice SDK fires
call(_:isReconnectingWithError:)andcallDidReconnect(_:)on network changes. Show a "Reconnecting..." indicator — the call may survive if the interruption is brief (cellular handoff, Wi-Fi switch). - ICE gathering issue on iOS 18: Fixed in Voice SDK 6.12.0 and Video SDK 5.8.3. If stuck on older versions, network handover during calls may fail silently. Update the SDK.
- Edge selection matters for mobile: Default
roamingworks globally but adds a negotiation round-trip. For latency-sensitive apps targeting a specific region, pin the edge (e.g.,TwilioVoiceSDK.edge = "ashburn").
Video-Specific
- Only
grouproom type on new accounts: Accounts created after specific date only support Group rooms. Attemptingpeer-to-peerorsmall-groupreturns error 53126. Check your account's room type support. - Virtual backgrounds require iOS 17+: The
TwilioVirtualBackgroundProcessorsframework (private beta, Video 5.11.0+) only works on iOS 17 and later. - H.264 hardware encoder limit: iOS devices support max 3 simultaneous H.264 hardware encoders. In multi-participant rooms with screen share, some tracks may fall back to VP8 software encoding.
- Screen share requires Broadcast Upload Extension: iOS does not allow apps to capture the screen directly (except via ReplayKit). You must create a separate Broadcast Upload Extension target in Xcode and use
TVIReplayKitVideoSource. TVITrackPriorityAPIs are deprecated in 5.10.x: Priority-based bandwidth allocation methods are deprecated. Remove usage to avoid warnings.
Related Resources
- Voice SDKs Skill — Cross-platform Voice SDK guide (tokens, TwiML App, edge locations, call messages)
- Video Skill — Video room types, recording, compositions, transcription
- Video SDK Integration Reference — JS, iOS, Android connection patterns
- IAM Skill — API Key creation, AccessToken generation, credential management
- Voice Insights Skill — SDK call quality diagnostics (iOS SDK generates Insights events)
- Recordings Skill — Server-side recording methods (iOS SDK cannot record client-side)
- Twilio Voice iOS SDK API Reference:
https://twilio.github.io/twilio-voice-ios/docs/latest/ - Twilio Voice iOS Quickstart:
https://github.com/twilio/voice-quickstart-ios - Twilio Video iOS Quickstart:
https://github.com/twilio/video-quickstart-ios
Reference Files
| Topic | File | When to read |
| CallKit + PushKit setup | references/callkit-pushkit.md | Setting up incoming/outgoing calls with native UI |
| SDK versions and requirements | references/sdk-versions.md | Checking compatibility, minimum iOS versions, Xcode requirements |
| Test evidence | references/test-results.md | Verifying claims about token generation and SDK behavior |
| Assertion audit | references/assertion-audit.md | Reviewing provenance of all factual claims |
| Voice SDK ↔ SIP bridge | /skills/sip/references/sdk-sip-bridge.md | Bridging SDK calls to SIP endpoints, codec negotiation, decision matrix |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

