跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.kontext.so/llms.txt

Use this file to discover all available pages before exploring further.

SDK 仓库中的 Example 目录提供了一个完整可运行的 UIKit demo,可使用你自己的 publisher token 端到端运行。

克隆并配置

git clone https://github.com/kontextso/sdk-swift.git
cd sdk-swift
cp ExampleSecrets.swift.example ExampleSecrets.swift
# 编辑 ExampleSecrets.swift,把 `publisherToken` 设置为你的真实 token。
open Example/Example.xcodeproj
然后在模拟器或真机上运行 Example scheme。
ExampleSecrets.swift 位于仓库根目录(不在 Example/ 中),且已被 gitignore,所以你的 token 不会被提交。Xcode 项目通过 ../../ExampleSecrets.swift 引用它;如果文件缺失,构建会清晰地失败——请先复制 .example 模板再打开 Xcode。
默认的 publisherToken 占位值(YOUR_PUBLISHER_TOKEN)不会返回真实广告——请用你在 发布方后台 拿到的 token 替换它。

你将看到什么

启动后,demo 会展示一个聊天界面,并预置一些用户 + 助手消息。当你发送消息时,SDK 会在后台触发 /preload,并在助手回复下方渲染广告。

链接