You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用flutter_callkit_incoming在iOS显示通话通知时触发空值错误

iOS端Flutter CallKit空值解包错误问题

问题描述

使用flutter_callkit_incoming: ^1.0.3+3包实现通话通知功能,代码严格遵循官方文档编写。在iOS参数中设置iconName为"AppIcon"(该文件夹包含所有应用图标)时,触发空值解包错误;按照官方示例创建CallKitIcon文件夹并完成配置后,仍出现相同错误。尝试将包版本降级至1.0.2+2,问题依旧存在。

错误信息

* thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: Unexpectedly found nil while unwrapping an Optional value
    frame #0: 0x000000018bd65c04 libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`:
->  0x18bd65c04 <+0>: ret
libswiftCore.dylib`:
    0x18bd65c08 <+0>: b      0x18bd65c04               ; _swift_runtime_on_report
libswiftCore.dylib`:
    0x18bd65c0c <+0>: adrp   x8, 378792
    0x18bd65c10 <+4>: ldrb   w0, [x8, #0x744]
Target 0: (Runner) stopped.
Lost connection to device.
Exited

代码示例

final params = CallKitParams(
    id: 'uuid',
    nameCaller: 'Hien Nguyen',
    appName: 'Callkit',
    avatar: 'https://i.pravatar.cc/100',
    handle: '0123456789',
    type: 0,
    duration: 30000,
    textAccept: 'Accept',
    textDecline: 'Decline',
    textMissedCall: 'Missed call',
    textCallback: 'Call back',
    extra: <String, dynamic>{'userId': '1a2b3c4d'},
    headers: <String, dynamic>{'apiKey': 'Abc@123!', 'platform': 'flutter'},
    android: AndroidParams(
      isCustomNotification: true,
      isShowLogo: false,
      isShowCallback: true,
      isShowMissedCallNotification: true,
      ringtonePath: 'system_ringtone_default',
      backgroundColor: '#0955fa',
      backgroundUrl: 'assets/test.png',
      actionColor: '#4CAF50',
    ),
    ios: IOSParams(
      iconName: 'CallKitLogo',
      handleType: '',
      supportsVideo: true,
      maximumCallGroups: 2,
      maximumCallsPerCallGroup: 1,
      audioSessionMode: 'default',
      audioSessionActive: true,
      audioSessionPreferredSampleRate: 44100.0,
      audioSessionPreferredIOBufferDuration: 0.005,
      supportsDTMF: true,
      supportsHolding: true,
      supportsGrouping: false,
      supportsUngrouping: false,
      ringtonePath: 'system_ringtone_default',
    ),
  );
  await FlutterCallkitIncoming.showCallkitIncoming(params);

内容的提问来源于stack exchange,提问作者Vipul waghmare

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 19:52:51