# appstore_create_app

> 在 App Store Connect 上建立 App 的記錄，必要時會先向 Apple 註冊其 bundle ID。

Source: https://air.build/tw/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/tw/docs/app-store/connect-apple-developer-account/)）。團隊的任何成員都可以呼叫；當擁有者的登入已失效且只有擁有者能續期時，呼叫會以下方的句子失敗，直到擁有者重新登入為止。

App 會建立在團隊唯一已連結的 Apple 團隊中，或 `appleTeamId` 中。

| 唯讀 | 破壞性 | 冪等 |
| --- | --- | --- |
| 否 | 否 | 否 |

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字串（UUID） | yes | — | 團隊，來自 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/)。 |
| `appleTeamId` | 字串（UUID） | 連結多個 Apple 團隊時必填 | 唯一已連結的那一個 | 要在其中建立 App 的 Apple 團隊，來自 [appstore_list_apple_teams](https://air.build/tw/docs/mcp-tools/appstore_list_apple_teams/)。 |
| `projectId` | 字串（UUID） | 與 `bundleId` 二擇一 | — | 為這個專案建立 App，來自 [list_projects](https://air.build/tw/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/tw/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/tw/docs/mcp-tools/server/#errors)。

| 訊息 | 何時出現 | 處理方式 |
| --- | --- | --- |
| Pass projectId or bundleId. | 兩者都沒有傳送 | 傳送其中一個 |
| No such Project in this Team. | `projectId` 不是該團隊的專案 | 從 [list_projects](https://air.build/tw/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/tw/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/tw/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"
  }
}
```
