跳转到正文

iOS 配置

GitHub

安装插件后,Contentsquare 追踪会自动启动;但 SDK 日志、截图捕获和回放配置等 iOS 应用内功能,仍需配置上游 URL 处理。

1. 添加 URL scheme

1. 添加 URL scheme

添加 cs-$(PRODUCT_BUNDLE_IDENTIFIER) 到 Xcode 中的 app URL schemes 或宿主 app 中 Info.plist.

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>cs-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
2. 转发 Contentsquare deeplinks

在您的 Capacitor 宿主 app 处理传入 URL 的地方,将其转发给原生 SDK:

import ContentsquareModule
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
Contentsquare.handle(url: url)
return true
}
import ContentsquareModule
func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) {
if let url = urlContexts.first?.url {
Contentsquare.handle(url: url)
}
}
import ContentsquareModule
.onOpenURL { url in
Contentsquare.handle(url: url)
}
  • 在真机或模拟器上启动 App。
  • 使用以下方式过滤 Xcode 或 Console 日志 CSLIB.
  • 打开 Contentsquare 移动端工具并触发应用内功能,以确认 deeplink 已被正确处理。

如果你正在使用 iOS 配置 要规划原生插件工作,请将其与 使用 @capgo/capacitor-contentsquare 用于“使用 @capgo/capacitor-contentsquare”中的原生能力, Capgo 插件目录 查看 Capgo 插件目录中的产品工作流, Capgo 提供的 Capacitor 插件 查看由 Capgo 提供的 Capacitor 插件中的实现细节, 添加或更新插件 关于“添加或更新插件”中的实现细节,以及 Ionic Enterprise 插件替代方案 关于“Ionic Enterprise 插件替代方案”中的产品工作流。