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

iOS中能否将接收Deeplink的APP以Bottom Sheet形式显示?

iOS中通过Deeplink唤起APP并以Bottom Sheet形式显示的可行性

结论:可行,但需依赖iOS 13+的多Scene架构或App Clips功能,同时需符合系统规范与审核要求

核心实现思路

iOS默认的APP唤起逻辑是全屏覆盖原APP,但通过以下两种方式可实现类似Bottom Sheet的悬浮显示效果:

1. 多Scene架构实现(iOS 13+)

利用iOS的多Scene机制,通过Deeplink唤起时创建一个独立的模态场景,配置为半透明的Sheet样式:

  • Info.plist配置:添加多Scene支持,新增针对Deeplink的场景配置:
    <key>UIApplicationSceneManifest</key>
    <dict>
      <key>UISceneConfigurations</key>
      <dict>
        <key>UIWindowSceneSessionRoleApplication</key>
        <array>
          <!-- 原有全屏场景配置 -->
          <dict>
            <key>UISceneConfigurationName</key>
            <string>Default Configuration</string>
            <key>UISceneDelegateClassName</key>
            <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
          </dict>
          <!-- Deeplink专属Sheet场景配置 -->
          <dict>
            <key>UISceneConfigurationName</key>
            <string>Deeplink Sheet Configuration</string>
            <key>UISceneDelegateClassName</key>
            <string>$(PRODUCT_MODULE_NAME).DeeplinkSheetSceneDelegate</string>
            <key>UIScenePresentationContext</key>
            <dict>
              <key>UIScenePresentationStyle</key>
              <string>pageSheet</string>
            </dict>
          </dict>
        </array>
      </dict>
    </dict>
    
  • SceneDelegate处理:在专属的DeeplinkSheetSceneDelegate中,设置窗口的根控制器样式,并处理Deeplink逻辑:
    class DeeplinkSheetSceneDelegate: UIResponder, UIWindowSceneDelegate {
      var window: UIWindow?
    
      func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        let window = UIWindow(windowScene: windowScene)
        let rootVC = DeeplinkHandlerViewController()
        // 设置Sheet样式
        rootVC.modalPresentationStyle = .pageSheet
        // 自定义Sheet高度
        rootVC.preferredContentSize = CGSize(width: UIScreen.main.bounds.width, height: 400)
        window.rootViewController = rootVC
        self.window = window
        window.makeKeyAndVisible()
      }
    
      func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        // 处理Deeplink逻辑
        guard let url = URLContexts.first?.url else { return }
        (window?.rootViewController as? DeeplinkHandlerViewController)?.handleDeeplink(url)
      }
    }
    
  • 效果说明:该场景会以半透明的PageSheet形式显示,原APP会进入后台,但视觉上保持在Sheet下方,符合你需要的Bottom Sheet效果。

2. App Clips实现(iOS 14+)

App Clips是苹果推出的轻量APP片段,默认以模态Sheet形式唤起,完美适配Deeplink场景:

  • 配置App Clips的Deeplink关联,用户点击Deeplink时会直接唤起Sheet样式的App Clip
  • 无需复杂的多Scene配置,符合系统原生交互规范,且更容易通过App Store审核

关键限制

  • 仅支持iOS 13+(多Scene)或iOS 14+(App Clips)
  • 多Scene实现需确保Sheet场景的交互逻辑独立,避免与主场景冲突
  • 必须符合App Store审核规则,禁止滥用Sheet形式干扰用户操作(如强制锁定Sheet无法关闭)
  • iPad上的Sheet样式会自动适配为FormSheet,与iPhone的PageSheet表现略有差异

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 19:05:32