iOS 应用
iOS 节点应用:连接 Gateway、配对、Canvas 与故障排除
可用性:内部预览。目前 iOS 应用尚未公开分发。
它能做什么
- 通过 WebSocket 连接 Gateway(同一局域网或 tailnet)。
- 暴露节点能力:Canvas、屏幕截图、摄像头采集、位置、对讲模式、语音唤醒。
- 接收 ''node.invoke'' 命令,并上报节点状态事件。
依赖条件
- Gateway 需要运行在另一台设备上(macOS、Linux,或 Windows 通过 WSL2)。
- 网络路径满足其一:
- 同一 LAN,通过 Bonjour 发现,或
- 通过 tailnet 使用 unicast DNS-SD(示例域:''openclaw.internal.''),''或''
- 手动填写 host/port(兜底)
快速开始(配对 + 连接)
1. 启动 Gateway:
openclaw gateway --port 18789
2. 在 iOS 应用中打开 Settings,选择发现到的 gateway(或启用 Manual Host 并填写 host/port)。
3. 在 gateway 主机上批准配对请求:
openclaw nodes pending openclaw nodes approve '<requestId>'
4. 验证连接:
openclaw nodes status
openclaw gateway call node.list --params "{'}"发现路径
#
Bonjour(LAN)
Gateway 会在 ''local.'' 上广播 ''local.''。iOS 应用会自动列出这些 gateway。
#
Tailnet(跨网络)
如果 mDNS 被阻断,使用 unicast DNS-SD 区域(选择一个域名,例如 ''openclaw.internal.''),并配置 Tailscale split DNS。
CoreDNS 示例见 ''Bonjour''。
#
手动 host/port
在 Settings 启用 ''Manual Host'' 并输入 gateway 的 host + port(默认 ''18789'')。
Canvas + A2UI
iOS 节点使用 WKWebView 渲染 canvas。可通过 ''node.invoke'' 驱动:
openclaw nodes invoke --node "iOS Node" --command canvas.navigate --params {"url":"http://<gateway-host>:18793/__openclaw__/canvas/"}说明:
- Gateway canvas host 提供 ''/__openclaw__/canvas/'' 与 ''/__openclaw__/a2ui/''。
- iOS 节点在连接时若发现 canvas host URL,会自动跳转到 A2UI。
- 使用 ''canvas.navigate'' 并传入 ''{"url":""}'' 可回到内置 scaffold。
#
Canvas eval / snapshot
openclaw nodes invoke --node "iOS Node" --command canvas.eval --params {"javaScript":"(() => { const {ctx} = window.__openclaw; ctx.clearRect(0,0,innerWidth,innerHeight); ctx.lineWidth=6; ctx.strokeStyle=\"#ff2d55\"; ctx.beginPath(); ctx.moveTo(40,40); ctx.lineTo(innerWidth-40, innerHeight-40); ctx.stroke(); return \"ok\"; })()"}openclaw nodes invoke --node "iOS Node" --command canvas.snapshot --params {"maxWidth":900,"format":"jpeg"}语音唤醒与对讲模式
- Voice wake 与 talk mode 可在 Settings 中启用。
- iOS 可能会在后台挂起音频;当应用不在前台时,语音功能应视为尽力而为。
常见错误
- ''NODE_BACKGROUND_UNAVAILABLE'':将 iOS 应用切到前台(canvas/camera/screen 命令需要前台)。
- ''A2UI_HOST_NOT_CONFIGURED'':Gateway 未广播 canvas host URL;检查 ''Gateway configuration'' 的 ''canvasHost''。
- 没出现配对提示:运行 ''openclaw nodes pending'' 并手动批准。
- 重装后无法重连:Keychain 中的配对 token 被清空;需要重新配对。