# appstore_upload_screenshots

> 从聊天附件、https 网址或团队正在运行的模拟器上传一种语言的 App Store 截屏，并等待 Apple 接受。

Source: https://air.build/cn/docs/mcp-tools/appstore_upload_screenshots/

为正在准备的版本（否则为已上架的版本）上传一种语言的 App Store 截屏，并等待 Apple 逐张接受。每张截屏来自以下三处之一：

- **聊天附件**：某人发送的图片，用 `attachmentId` 指定（见 [get_attachment](https://air.build/cn/docs/mcp-tools/get_attachment/)）。
- **https 网址**：从该网址下载图片。
- **团队的模拟器**：当前屏幕，立即截取。模拟器必须正在运行（见 [start_simulator](https://air.build/cn/docs/mcp-tools/start_simulator/)）。6.9 英寸 iPhone 模拟器（iPhone 17 Pro Max）能提供 Apple 要求的尺寸。

图片必须是 PNG 或 JPEG。除非发送了 `displayType`，否则显示尺寸根据每张图片的像素判断（见下表）。截屏会添加在已有截屏之后；使用 `replace` 时，会先删除该尺寸的现有截屏。每种尺寸 Apple 最多接受 10 张。版本中还没有该语言时，会添加它。调用两次会上传两次截屏。

这个工具可能需要几分钟。客户端接受流式响应时，它会以带进度的流返回（见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#transport)）。

| 只读 | 破坏性 | 幂等 |
| --- | --- | --- |
| 否 | 否 | 否 |

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | yes | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/)。 |
| `projectId` | 字符串（UUID） | 与 `appId` 二选一 | — | 这个 App 所属的项目，来自 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/)：这是指定 App 的常用方式。App 是 App Store Connect 上 bundle ID 与该项目构建的 bundle ID 相同的那个。两者都发送时，使用 `projectId`。 |
| `appId` | string | 与 `projectId` 二选一 | — | 来自 [appstore_list_apps](https://air.build/cn/docs/mcp-tools/appstore_list_apps/) 的 App Store Connect App ID，用于没有项目构建的 App。 |
| `appleTeamId` | 字符串（UUID） | no | 所有已连接的 Apple 团队 | 团队的某个 Apple 团队，来自 [appstore_list_apple_teams](https://air.build/cn/docs/mcp-tools/appstore_list_apple_teams/)。配合 `appId` 时，只在这个 Apple 团队中查找该 App。配合 `projectId` 时不需要：由项目的 App 决定。 |
| `platform` | 字符串：`IOS`、`MAC_OS`、`TV_OS`、`VISION_OS` | no | `IOS` | 哪个平台的 App Store 版本。 |
| `locale` | string | no | App 的主要语言 | 语言，例如 `en-US`。 |
| `displayType` | 字符串，下列显示尺寸之一 | no | 根据每张图片判断 | 本次调用中所有图片使用的 Apple 显示尺寸。 |
| `screenshots` | 包含 1 到 10 个对象的数组 | yes | — | 图片，按顺序排列。每项恰好包含 `attachmentId`、`url` 或 `simulator` 之一。 |
| `screenshots[].attachmentId` | 字符串（UUID） | 三者之一 | — | 聊天附件：某人发送的图片。 |
| `screenshots[].url` | 字符串（https 网址） | 三者之一 | — | 要下载的图片。仅限 `https://` 地址。 |
| `screenshots[].simulator` | 字符串或 null | 三者之一 | — | 立即截取团队正在运行的模拟器：它的设备 ID 来自 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/)，或用 null 表示默认设备。 |
| `replace` | boolean | no | false | 先删除相同尺寸的现有截屏。 |

显示尺寸，以及识别每种尺寸所依据的像素尺寸（竖屏，或旋转为横屏的相同尺寸）：

| `displayType` | 设备 | 识别依据 |
| --- | --- | --- |
| `APP_IPHONE_67` | iPhone 6.9 英寸 | 1320 × 2868, 1290 × 2796, 1260 × 2736 |
| `APP_IPHONE_65` | iPhone 6.5 英寸 | 1284 × 2778, 1242 × 2688 |
| `APP_IPHONE_61` | iPhone 6.1 英寸 | 1206 × 2622, 1179 × 2556, 1170 × 2532 |
| `APP_IPHONE_58` | iPhone 5.8 英寸 | 1125 × 2436, 1080 × 2340 |
| `APP_IPHONE_55` | iPhone 5.5 英寸 | 1242 × 2208 |
| `APP_IPHONE_47` | iPhone 4.7 英寸 | 750 × 1334 |
| `APP_IPHONE_40` | iPhone 4 英寸 | 仅配合 `displayType` |
| `APP_IPAD_PRO_3GEN_129` | iPad 13 英寸 | 2064 × 2752, 2048 × 2732 |
| `APP_IPAD_PRO_3GEN_11` | iPad 11 英寸 | 1668 × 2420, 1668 × 2388, 1640 × 2360, 1488 × 2266 |
| `APP_IPAD_PRO_129` | iPad Pro 12.9 英寸（第 2 代） | 仅配合 `displayType` |
| `APP_IPAD_105` | iPad 10.5 英寸 | 仅配合 `displayType` |
| `APP_IPAD_97` | iPad 9.7 英寸 | 仅配合 `displayType` |
| `APP_DESKTOP` | Mac | 1280 × 800, 1440 × 900, 2560 × 1600, 2880 × 1800 |
| `APP_APPLE_TV` | Apple TV | 仅配合 `displayType` |
| `APP_APPLE_VISION_PRO` | Apple Vision Pro | 3840 × 2160 |
| `APP_WATCH_ULTRA` | Apple Watch Ultra | 仅配合 `displayType` |
| `APP_WATCH_SERIES_10` | Apple Watch Series 10 | 仅配合 `displayType` |
| `APP_WATCH_SERIES_7` | Apple Watch Series 7 | 仅配合 `displayType` |

每个工具对输入所做的检查见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#errors)。

## 结果

一个 JSON 对象，同时以文本和 `structuredContent` 返回。

| 字段 | 说明 |
| --- | --- |
| `version` | 版本号 |
| `locale` | 语言 |
| `uploaded` | 每张截屏一项：`displayType`，然后是下列字段 |

| 字段 | 说明 |
| --- | --- |
| `screenshotId` | Apple 给该截屏的 ID，供 appstore_delete_screenshots 使用 |
| `fileName` | 它的文件名 |
| `size` | 它的像素尺寸，例如 `1320x2868`，或 null |
| `state` | Apple 的处理状态：`AWAITING_UPLOAD`、`UPLOAD_COMPLETE`、`COMPLETE` 或 `FAILED` |
| `problems` | 处理失败时，Apple 对问题的描述 |
| `preview` | 300 × 650 PNG 预览图的地址，或 null |

大约一分钟后 `state` 仍为 `UPLOAD_COMPLETE` 的截屏会按原样报告；Apple 会稍后完成处理。`FAILED` 会在 `problems` 中附带 Apple 给出的原因。

```json
{
  "version": "1.2.0",
  "locale": "en-US",
  "uploaded": [
    {
      "displayType": "APP_IPHONE_67",
      "screenshotId": "00000000-0000-0000-0000-000000000000",
      "fileName": "home.png",
      "size": "1320x2868",
      "state": "COMPLETE",
      "problems": [],
      "preview": "https://example.com/preview.png"
    }
  ]
}
```

## 错误

每个错误都以工具错误（`isError: true`）返回。_斜体_ 文字代表句中的具体值。所有工具都可能返回的错误见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#errors)。

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| screenshots must list 1 to 10 images. | `screenshots` 为空或超过 10 项 | 发送 1 到 10 项 |
| Each screenshot needs attachmentId, url, or simulator. | 某一项三者都没有 | 为每一项指定来源 |
| Could not read attachment _id_. | 无法下载该附件 | 用 [get_attachment](https://air.build/cn/docs/mcp-tools/get_attachment/) 检查 |
| Screenshot URLs must be https. | 某个 `url` 不是 `https://` | 使用 https 地址 |
| Could not download _url_. | 该地址没有返回文件 | 检查地址 |
| The _device_ Simulator is not running. Start it with start_simulator. | 使用了 `simulator`，但团队中该设备的模拟器已关闭 | 用 [start_simulator](https://air.build/cn/docs/mcp-tools/start_simulator/) 启动它 |
| The _device_ Simulator is still starting. Call start_simulator to wait for it. | 模拟器尚未就绪 | 用 [start_simulator](https://air.build/cn/docs/mcp-tools/start_simulator/) 等待 |
| No Simulator _id_. Offered: _ids_. | `simulator` 指定的设备不是 AirBuild 提供的 | 使用 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/) 返回的 ID |
| Screenshot _n_ is not a PNG or JPEG. | 图片是其他格式 | 转换格式 |
| Screenshot _n_ is _width_x_height_, which is no App Store size. iPhone screenshots must be 1320x2868 (6.9-inch) or 1284x2778 (6.5-inch); iPad 2064x2752 (13-inch). | 像素尺寸与任何显示尺寸都不匹配，且没有发送 `displayType` | 调整图片尺寸，或发送 `displayType` |
| App Store Connect did not add _locale_. | Apple 没有添加该语言 | 重试 |
| App Store Connect did not create the screenshot set. | Apple 没有创建该尺寸的截屏组 | 重试 |
| App Store Connect did not reserve the upload. | Apple 没有接受上传 | 重试 |
| Apple refused the upload of _file_ (_status_). Try again. | 向 Apple 发送图片失败 | 重试 |
| This app has no App Store version yet. Start one with appstore_prepare_version. | 该 App 在这个平台上没有版本 | 用 [appstore_prepare_version](https://air.build/cn/docs/mcp-tools/appstore_prepare_version/) 新建一个 |
| Pass projectId, or appId from appstore_list_apps. | `projectId` 和 `appId` 都没有发送 | 发送其中一个 |
| This Project has not been built for iOS yet, so it has no bundle id to find its app by. Ask the Team's Agent to build it, or pass appId. | 该项目从未构建过 iOS 版本 | 请项目的智能体构建一个 iOS 版本（[send_message](https://air.build/cn/docs/mcp-tools/send_message/)），或用 `appId` 指定 App |
| This Project has no app on App Store Connect yet. Create one with appstore_create_app (its bundle id is the Project's), or pass appId. | 团队已连接的 Apple 团队中没有 App 的 bundle ID 与项目相同，或没有连接任何 Apple 团队 | 用 [appstore_create_app](https://air.build/cn/docs/mcp-tools/appstore_create_app/) 创建 App，或用 `appId` 指定另一个 App |
| No connected Apple team of this Team has that app. See appstore_list_apps. | `appId` 不是任何已连接 Apple 团队（或 `appleTeamId`）中的 App | 从 [appstore_list_apps](https://air.build/cn/docs/mcp-tools/appstore_list_apps/) 获取 ID |
| platform must be IOS, MAC_OS, TV_OS or VISION_OS. | `platform` 是其他值 | 发送这四个值之一 |
| App Store Connect: _Apple's sentence_ | Apple 拒绝了请求。后面最多附上 Apple 自己的五句话，Apple 指明相关字段时会在括号中注明。App Store Connect 中有待接受的 Apple 协议时，也会这样被拒绝 | 按 Apple 的说明处理。协议由 Apple Developer 账户的账户持有人在 App Store Connect 中接受（商务 › 协议） |
| App Store Connect answered _status_. Try again in a moment. | Apple 拒绝了，但没有说明原因 | 稍后再试 |

出错之前上传的图片仍保留；用 [appstore_screenshots](https://air.build/cn/docs/mcp-tools/appstore_screenshots/) 查看。

## 示例

```json
{
  "name": "appstore_upload_screenshots",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "locale": "en-US",
    "screenshots": [
      {
        "simulator": null
      },
      {
        "attachmentId": "00000000-0000-0000-0000-000000000000"
      }
    ],
    "replace": true
  }
}
```
