跳过内容

iOS 设置

内容广场跟踪会自动启动一次插件安装,但 iOS 应用内功能,如 SDK 日志、截图捕获和重放配置仍需要上游 URL 处理设置。

1. 添加 URL 方案

标题:1. 添加 URL 方案

添加 cs-$(PRODUCT_BUNDLE_IDENTIFIER) 在 Xcode 或主机应用的 Info.plist.

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>cs-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
标题:2. 将内容广场深度链接转发

在哪里您的 Capacitor 主机应用处理 incoming URL 时,将它们转发到本机 SDK:

AppDelegate

AppDelegate
import ContentsquareModule
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
Contentsquare.handle(url: url)
return true
}

SceneDelegate

SceneDelegate
import ContentsquareModule
func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) {
if let url = urlContexts.first?.url {
Contentsquare.handle(url: url)
}
}

SwiftUI

SwiftUI
import ContentsquareModule
.onOpenURL { url in
Contentsquare.handle(url: url)
}
  • Launch the app on a device or simulator.
  • 过滤 Xcode 或 Console 日志 CSLIB.
  • 打开 Contentsquare 移动工具并触发内应用功能以确认 deeplink 被处理。