# appstore_create_app

> 在 App Store Connect 上创建 App 的记录，必要时先向 Apple 注册其 bundle ID。

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

在 App Store Connect 上创建 App 的记录：这是第一个 TestFlight 构建版本或 App 审核提交之前的步骤。如果 Apple 团队尚未把该 bundle ID 注册为 App ID，工具会先注册它。Apple 创建 App 时会附带第一个版本 `1.0`，与 App Store Connect 本身的做法相同。名称是 App 在 App Store 上的名称，不能与 App Store 上的任何名称重复。没有任何工具可以撤销这一操作。

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

App 会创建在团队唯一已连接的 Apple 团队中，或 `appleTeamId` 中。

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

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | yes | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/)。 |
| `appleTeamId` | 字符串（UUID） | 连接了多个 Apple 团队时必填 | 唯一已连接的那个 | 要在其中创建 App 的 Apple 团队，来自 [appstore_list_apple_teams](https://air.build/cn/docs/mcp-tools/appstore_list_apple_teams/)。 |
| `projectId` | 字符串（UUID） | 与 `bundleId` 二选一 | — | 为这个项目创建 App，来自 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/)：使用它的 bundle ID。项目有 bundle ID 时，优先于 `bundleId`。 |
| `bundleId` | string | 与 `projectId` 二选一 | — | bundle ID，例如 `com.example.app`，用于没有项目指定它（或项目尚未构建）的情况。 |
| `name` | 字符串，最多 30 个字符 | yes | — | App Store 名称。 |
| `sku` | string | no | bundle ID | 你为 App 设定的唯一 ID。不填时使用 bundle ID，其中字母、数字、`.`、`_` 和 `-` 以外的字符都替换为 `-`。 |
| `primaryLocale` | string | no | `en-US` | 商店信息的主要语言，例如 `en-US`、`zh-Hans`。 |
| `platforms` | 由 `IOS`、`MAC_OS`、`TV_OS`、`VISION_OS` 组成的数组 | no | `["IOS"]` | App 发布的平台。 |

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

## 结果

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

| 字段 | 说明 |
| --- | --- |
| `appId` | App Store Connect 给新 App 的 ID |
| `name`, `bundleId`, `sku`, `primaryLocale` | 与 Apple 保存的一致 |
| `appleTeamId`, `appleTeam` | 创建 App 的 Apple 团队 |
| `registeredBundleId` | 这次调用把 bundle ID 注册为 App ID 时为 true |
| `projectId` | 构建它的项目（发送的那个，或 bundle ID 相同的项目），或 null |

```json
{
  "appId": "1234567890",
  "name": "Notes",
  "bundleId": "com.example.notes",
  "sku": "com.example.notes",
  "primaryLocale": "en-US",
  "appleTeamId": "00000000-0000-0000-0000-000000000000",
  "appleTeam": "Example Inc.",
  "registeredBundleId": true,
  "projectId": "00000000-0000-0000-0000-000000000000"
}
```

## 错误

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

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| Pass projectId or bundleId. | 两者都没有发送 | 发送其中一个 |
| No such Project in this Team. | `projectId` 不是该团队的项目 | 从 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/) 获取 |
| This Project has no bundle id yet: it gets one with its first iOS build. Pass bundleId to choose one now. | 该项目从未构建过 iOS 版本，且没有发送 `bundleId` | 发送 `bundleId`，或先让项目构建一次 |
| The Bundle ID _bundle id_ is already in use by another Apple developer account. Choose a different Bundle ID. | 另一个 Apple 开发者账户占用了该 bundle ID | 和对方商量换一个 bundle ID |
| This Apple team is read-only because the signed-in Apple ID is not an Admin or Account Holder. | 拥有者的 Apple ID 在该 Apple 团队中没有 Admin 或 Account Holder 角色（个人开发者账户时为：“…because it is an individual enrollment and the signed-in Apple ID is not its Account Holder.”） | 团队拥有者需要在 Apple 获得该角色，或使用另一个 Apple 团队 |
| This Team has no Apple Developer account connected. The Team's owner connects one in AirBuild (Settings → Apple Developer). | 团队拥有者没有关联任何 Apple 开发者账户 | 请团队拥有者关联一个（在 App 中：**设置** › **开发者**） |
| None of this Team's Apple teams is connected yet. The Team's owner finishes connecting it in AirBuild. | 拥有者有 Apple 团队，但没有一个已开启并就绪 | 请团队拥有者完成连接 |
| This Team works with several Apple teams; pass appleTeamId: _name_ = _id_, …. | 连接了多个 Apple 团队，但没有发送 `appleTeamId` | 发送 `appleTeamId`，取句中列出的某个 ID |
| That Apple team is not one of this Team's. See appstore_list_apple_teams. | `appleTeamId` 不是该团队的 Apple 团队 | 从 [appstore_list_apple_teams](https://air.build/cn/docs/mcp-tools/appstore_list_apple_teams/) 获取 |
| 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 中重新登录 |
| _Apple 的原话_ | Apple 拒绝了这个 App，例如名称已被占用或有待接受的协议 | 按 Apple 的说明处理：换一个名称，或让账户持有人在 App Store Connect 中接受协议 |
| 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_create_app",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "name": "Notes"
  }
}
```
