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

Flutter iOS端无法完整复制WhatsApp/Telegram多段聊天内容

iOS端Flutter剪贴板获取WhatsApp多条聊天内容仅返回单条

我做了一个功能,让用户手动把WhatsApp等聊天应用的多条聊天内容复制粘贴到Flutter应用的TextField里。Android端完全正常,但iOS端只能粘贴选中的多条聊天中的某一条。在iOS原生应用或备忘录里粘贴是可以显示全部内容的。打印Flutter剪贴板内容后发现,iOS端只会输出多条选中聊天里的随机一条,怀疑是Flutter在iOS端的剪贴板处理有问题。

已尝试操作

  • 在macOS、iPhone、iPad上选中多条WhatsApp聊天内容,粘贴到Flutter文本框并打印剪贴板内容,所有iOS设备均出现相同问题
  • 使用以下代码获取剪贴板内容:
void pasteFromClipboard() async {
  ClipboardData? clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
  if (clipboardData != null) {
    String? completeText = clipboardData.text;
    print('Previous Paste from clipboard data: $completeText');
    completeText = (clipboardData.text ?? '').replaceAll(RegExp(r'[\u202A-\u202E\u00A0\u200B]'), ' ').trim();
    print('Formatted Paste from clipboard data: $completeText');
  }
}

预期输出

[29/08/24, 5:37:40 PM] +31 121548: Can you please let me know ho I can get the refund
[29/08/24, 6:49:02 PM] My Name: I can help with the refund. Can you please let me know the reason?
[29/08/24, 5:36:31 PM] +31 121548: Hi

实际输出

仅输出多条复制聊天中的随机一条:

"[29/08/24, 6:49:02 PM] My Name: I can help with the refund. Can you please let me know the reason?"

该问题在iOS实体设备和模拟器上均会出现。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 00:12:36