参考 • 5 分钟阅读
设备型号数据库
OpenClaw 如何在 macOS 应用程序中为 Apple 设备型号标识符提供友好名称。
macOS 伴侣应用程序通过将 Apple 型号标识符(例如 iPad16,6、Mac16,6)映射到人类可读的名称,在实例 UI 中显示友好的 Apple 设备型号名称。
该映射作为 JSON 供应商提供在以下位置:
- apps/macos/Sources/OpenClaw/Resources/DeviceModels/
Tutorial.step
数据源
我们目前从 MIT 许可的存储库供应商映射:
- kyle-seongwoo-jun/apple-device-identifiers
为了保持构建确定性,JSON 文件被固定到特定的上游提交(记录在 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中)。
Tutorial.step
更新数据库
1. 选择你想要固定到的上游提交(iOS 一个,macOS 一个)。
2. 更新 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中的提交哈希。
3. 重新下载固定到这些提交的 JSON 文件:
Bash
IOS_COMMIT="<commit sha for ios-device-identifiers.json>"
MAC_COMMIT="<commit sha for mac-device-identifiers.json>"
curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${IOS_COMMIT}/ios-device-identifiers.json" -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/ios-device-identifiers.json
curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${MAC_COMMIT}/mac-device-identifiers.json" -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/mac-device-identifiers.json4. 确保 apps/macos/Sources/OpenClaw/Resources/DeviceModels/LICENSE.apple-device-identifiers.txt 仍然与上游匹配(如果上游许可证更改,则替换它)。
5. 验证 macOS 应用程序干净构建(无警告):
Bash
swift build --package-path apps/macos