跳过内容

iOS

GitHub

How iOS behavior works

iOS 行为原理

On iOS, the plugin reports the incoming call to CallKit. That gives you the system incoming-call sheet and standardized call actions without building your own native incoming-call UI.

requestPermissions() iOS 中,插件会将来电报告给 CallKit。这样可以获得系统的来电呼叫sheet和标准化的呼叫操作,而无需自己构建原生来电呼叫 UI。

resolves immediately on iOS because CallKit itself does not require a runtime permission dialog.

iOS 上会立即解决,因为 CallKit 本身不需要运行时权限对话框。
import { IncomingCallKit } from '@capgo/capacitor-incoming-call-kit';
await IncomingCallKit.showIncomingCall({
callId: 'call-42',
callerName: 'Ada Lovelace',
handle: '+1 555 010 020',
ios: {
handleType: 'phoneNumber',
supportsHolding: true,
supportsDTMF: false,
},
});

基本示例

Copy to clipboard

复制到剪贴板 ios.handleType Handle types

  • generic 处理类型:
  • phoneNumber For real phone numbers
  • emailAddress For email-based identities

后台来电

后台来电

This plugin does not register PushKit or APNs for you.

为了在 iOS 上实现真实的后台或终止状态的铃声,需要在主应用中配置匹配传输策略的原生 Apple 推送设置:

  1. 在使用 Apple 推送传输的应用中,启用推送通知
  2. 在使用 VoIP 推送流的应用中,启用 VoIP 后台模式
  3. 将来电事件传递给应用并在 Capacitor 桥可用时调用此插件

如果您的铃声事件仅存在于 JavaScript 中,则在应用已在前台运行时将获得最佳体验

麦克风和摄像头权限

麦克风和摄像头权限

CallKit 不会替代您的媒体 SDK。如果真实的呼叫会话使用麦克风或摄像头访问,使用说明仍然需要在您的应用程序中:

<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone for calls.</string>
<key>NSCameraUsageDescription</key>
<string>This app uses the camera for video calls.</string>

仅添加您的真实呼叫流程需要的键

在应用层中保留这些责任

标题:在应用层中保留这些责任
  • PushKit 和 APNs 注册
  • 身份验证和令牌刷新
  • 在插件发射后加入真实房间或 VoIP 会话 callAccepted
  • 当插件发射时结束或恢复远程呼叫状态 callDeclined, callEndedcallTimedOut

如果您正在使用 iOS 来规划原生插件工作,连接它与 使用 @capgo/capacitor-incoming-call-kit 来实现原生能力的使用 @capgo/capacitor-incoming-call-kit, Capgo 原生插件目录 来实现产品工作流程的 Capgo 原生插件目录, Capacitor 由 Capgo 提供的插件 来实现实现细节的 Capacitor 由 Capgo 提供的插件, 添加或更新插件 来实现添加或更新插件的实现细节, 和 Ionic Enterprise 插件替代方案 为 Ionic Enterprise Plugin Alternatives 产品工作流程.