设备型号数据库(友好名称)

macOS 配套应用会在 Instances 界面中显示友好的 Apple 设备型号名称,通过将 Apple 型号标识符(如 iPad16,6Mac16,6)映射为人类可读的名称来实现。

映射数据以 JSON 格式存储在:

  • apps/macos/Sources/OpenClaw/Resources/DeviceModels/

数据来源

我们目前使用的映射数据来自 MIT 许可的仓库:

  • kyle-seongwoo-jun/apple-device-identifiers

为了保持构建的确定性,JSON 文件被固定到特定的上游提交版本(记录在 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中)。

更新数据库

  1. 选择你要固定的上游提交版本(iOS 和 macOS 各一个)。
  2. 更新 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中的提交哈希值。
  3. 重新下载固定到这些提交版本的 JSON 文件:
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.json
  1. 确保 apps/macos/Sources/OpenClaw/Resources/DeviceModels/LICENSE.apple-device-identifiers.txt 仍然与上游匹配(如果上游许可证发生变化,需要替换它)。
  2. 验证 macOS 应用能够正常构建(无警告):
swift build --package-path apps/macos