跳到內容

更新 OpenClaw Apple 裝置型號資料庫

身為開發者,你一定遇過這種情況:在後台看到一堆像 iPad16,6 或 Mac16,6 的型號代碼,卻完全想不起來這到底是哪一台裝置。這種冷冰冰的識別碼對排錯或使用者介面來說真的很不直覺。

macOS 輔助程式在 Instances UI 中會顯示親切的 Apple 裝置名稱,這背後是透過將 Apple 型號識別碼(例如 iPad16,6, Mac16,6)對應到人類可讀的名稱來實現的。

這些對應關係以 JSON 格式存放在:

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

我們目前從這個 MIT 授權的 GitHub 儲存庫引入對應資料:

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

為了確保建置(build)結果是確定的,JSON 檔案會鎖定在特定的 upstream commit(記錄在 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中)。

  1. 挑選你想鎖定的 upstream commit(iOS 一個,macOS 一個)。
  2. 更新 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中的 commit hash。
  3. 重新下載鎖定在這些 commit 的 JSON 檔案:
Terminal window
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 仍與 upstream 一致(如果 upstream 授權有變動請替換它)。
  2. 驗證 macOS app 是否能正常建置(沒有警告):
Terminal window
swift build --package-path apps/macos

AI Setup Assistant

OpenClaw

OpenClaw Expert

還是卡住了?

如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。