# appstore_update_privacy

> 把 App 的 App 隐私回答设置为与给定声明完全一致：预览更改、存储更改，或存储并发布。

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

把 App 的 App 隐私回答设置为与发送的声明完全一致：声明中的内容会被添加或更新，Apple 保存的回答中声明没有包含的会被删除。`mode` 决定执行到哪一步：

- `preview`（默认）显示将会发生的更改，不发送任何内容；
- `apply` 存储回答；
- `applyAndPublish` 存储回答并在 App Store 上发布。

声明会删除回答时，除非 `allowDeletes` 为 true，否则 `apply` 和 `applyAndPublish` 会拒绝执行；`preview` 会显示哪些回答将被删除。更改按先删除、再更新、最后添加的顺序进行，遇到第一次拒绝就停止；在此之前的更改会保留。

这个工具通过团队拥有者在 AirBuild 中的 Apple 登录工作（见 [关联你的 Apple 开发者账户](https://air.build/cn/docs/app-store/connect-apple-developer-account/)）。团队的任何成员都可以调用；当拥有者的登录已失效且只有拥有者能续期时，调用会以下面的句子失败，直到拥有者重新登录。

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

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `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 决定。 |
| `dataUsages` | 对象数组 | yes | — | 所有数据用途（下面各行）。不收集任何数据的 App：`[{"dataProtections": ["DATA_NOT_COLLECTED"]}]`。配合 `includeCatalog` 的 [appstore_privacy](https://air.build/cn/docs/mcp-tools/appstore_privacy/) 会列出所有标记值。 |
| `dataUsages[].category` | string | 收集数据时必填 | — | 数据类型，例如 `EMAIL_ADDRESS`、`PRECISE_LOCATION`。使用 `DATA_NOT_COLLECTED` 时不填。 |
| `dataUsages[].purposes` | 字符串数组 | 使用关联或不关联的保护方式时必填 | — | 例如 `APP_FUNCTIONALITY`、`ANALYTICS`。仅用于跟踪时不需要；使用 `DATA_NOT_COLLECTED` 时不填。 |
| `dataUsages[].dataProtections` | 字符串数组，至少 1 个 | yes | — | `DATA_LINKED_TO_YOU`、`DATA_NOT_LINKED_TO_YOU`、`DATA_USED_TO_TRACK_YOU`；或单独的 `DATA_NOT_COLLECTED`，作为唯一的一项。 |
| `mode` | 字符串：`preview`、`apply`、`applyAndPublish` | no | `preview` | 执行到哪一步（见上文）。 |
| `allowDeletes` | boolean | no | false | 允许 `apply` 和 `applyAndPublish` 删除声明中没有包含的回答。 |

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

## 结果

一个 JSON 对象，同时以文本和 `structuredContent` 返回。每项更改写作 “_类别_ / _用途_ / _保护方式_”，没有类别时用 `—`。使用 `preview` 时：

| 字段 | 说明 |
| --- | --- |
| `mode` | `preview` |
| `adds` | 将被添加的回答 |
| `updates` | 将被更改的回答 |
| `deletes` | 将被删除的回答 |
| `note` | 仅在有删除时出现：“Applying removes the deletes only with allowDeletes: true.” |

使用 `apply` 或 `applyAndPublish` 时：

| 字段 | 说明 |
| --- | --- |
| `mode` | 模式 |
| `changed` | 已完成的操作，每项为 “`create`、`update` 或 `delete`：_更改_” |
| `keptBecauseDeletesNotAllowed` | 因 Apple 没有提供删除方式而保留的回答 |
| `published` | 仅配合 `applyAndPublish`：回答现在是否已发布 |

```json
{
  "mode": "applyAndPublish",
  "changed": [
    "create: EMAIL_ADDRESS / APP_FUNCTIONALITY / DATA_LINKED_TO_YOU"
  ],
  "keptBecauseDeletesNotAllowed": [],
  "published": true
}
```

## 错误

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

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| This declaration removes _n_ existing data usage declaration(s). Confirm deletion to proceed. | `apply` 或 `applyAndPublish` 会删除回答，而 `allowDeletes` 不为 true；没有做任何更改 | 先预览，与对方确认，然后发送 `allowDeletes: true` |
| dataUsages must be a list. | `dataUsages` 不是数组 | 发送数组 |
| declaration.dataUsages must contain at least one entry. | `dataUsages` 为空 | 至少发送一项；不收集时用 `DATA_NOT_COLLECTED` |
| dataUsages[_i_].category must match [A-Z0-9_]+. | 某个类别不是有效的标记值 | 使用目录中的标记值 |
| dataUsages[_i_].purposes contains the invalid value "_value_". | 某个用途不是有效的标记值 | 使用目录中的标记值 |
| dataUsages[_i_].dataProtections is required. | 某一项没有保护方式 | 添加保护方式 |
| dataUsages[_i_].dataProtections contains the unsupported value "_value_". | 使用了这四种以外的保护方式 | 使用这四种之一 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot be combined with collected data usages. | `DATA_NOT_COLLECTED` 与其他项同时出现 | 单独发送它 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include other dataProtections. | `DATA_NOT_COLLECTED` 与其他保护方式同时出现 | 单独发送它 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include category. | `DATA_NOT_COLLECTED` 带有类别 | 去掉类别 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include purposes. | `DATA_NOT_COLLECTED` 带有用途 | 去掉用途 |
| dataUsages[_i_] with collected data cannot be combined with DATA_NOT_COLLECTED. | 收集数据的项出现在 `DATA_NOT_COLLECTED` 项之前 | 删掉其中一个 |
| dataUsages[_i_].category is required when data is collected. | 收集数据的项没有类别 | 添加类别 |
| dataUsages[_i_].purposes is required when data is collected. | 关联或不关联的项没有用途 | 添加用途 |
| The Team owner's Apple sign-in has lapsed and only they can renew it: ask them to open AirBuild and sign in to Apple again, then try once more. | 团队拥有者在 AirBuild 中的 Apple 登录已过期，没有拥有者参与 AirBuild 无法续期 | 告诉团队拥有者，请对方在 AirBuild 中重新登录（见 [关联你的 Apple 开发者账户](https://air.build/cn/docs/app-store/connect-apple-developer-account/)）。在此之前重试会得到同样的回答 |
| Another Apple account operation is already in progress. | 同一个 Apple 账户上正在进行另一个 App Store 操作 | 稍后再试；拥有者不需要重新登录 |
| Apple has locked this Apple Account for security reasons. Unlock it at account.apple.com by signing in with the Apple ID and password, then sign in again. | Apple 锁定了团队拥有者的 Apple 账户 | 只有团队拥有者能在 account.apple.com 解锁，然后在 AirBuild 中重新登录 |
| 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 |
| 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 拒绝了，但没有说明原因 | 稍后再试 |

## 示例

```json
{
  "name": "appstore_update_privacy",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "dataUsages": [
      {
        "category": "EMAIL_ADDRESS",
        "purposes": [
          "APP_FUNCTIONALITY"
        ],
        "dataProtections": [
          "DATA_LINKED_TO_YOU"
        ]
      }
    ],
    "mode": "preview"
  }
}
```
