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

iMessage与Slack中Firebase短链接无法正常工作求助

问题分析
  • Firebase短链接通过UIActivityViewController分享时,仅Slack和iMessage出现异常:
    • Slack分享界面卡顿
    • iMessage中调用handleUniversalLink解码返回404错误
  • 直接复制粘贴短链接可正常使用,当前实现代码:
let activityVC = UIActivityViewController(activityItems: [shortenURL], applicationActivities: nil)
activityVC.popoverPresentationController?.sourceView = self.view
self.present(activityVC, animated: true)
解决方案

1. 将短链接转为字符串传入

部分App(如iMessage、Slack)在处理URL类型分享内容时,会提前预加载或解析链接,导致异常。把短链接转为字符串传入,避免App提前触发解析逻辑:

let activityVC = UIActivityViewController(activityItems: [shortenURL.absoluteString], applicationActivities: nil)
activityVC.popoverPresentationController?.sourceView = self.view
self.present(activityVC, animated: true)

2. 针对特定App做适配

可通过excludedActivityTypes排除默认的iMessage/Slack分享入口,或自定义分享逻辑单独处理这两个App:

// 排除系统默认的iMessage和Slack分享类型
let excludedTypes: [UIActivity.ActivityType] = [.message, .postToSlack]
let activityVC = UIActivityViewController(activityItems: [shortenURL.absoluteString], applicationActivities: nil)
activityVC.excludedActivityTypes = excludedTypes
activityVC.popoverPresentationController?.sourceView = self.view
self.present(activityVC, animated: true)

// 如需单独处理这两个App,可自定义UIActivity实现专属分享逻辑

3. 检查Universal Link配置

确认Firebase短链接对应的Universal Link配置无误:

  • 苹果开发者后台已添加正确的关联域名(Associated Domains)
  • 服务器上的apple-app-site-association文件配置正确且可正常访问
  • Firebase控制台中已正确设置动态链接的关联域名

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.10 09:50:43