# Apple (App Store Connect and TestFlight)

Needed for iPhone testing through TestFlight and for the App Store. Not needed for the Prototype preset.

**Starwisp never submits your app and never holds your Apple credentials.** Your own workflow in your own GitHub uploads your builds with your own key. Submission to App Review is a button **you** tap. Starwisp automates *your own uploads*.

**Time:** 20 minutes for the key, after your account is approved. **Needs:** an Apple Developer Program membership, and the **Account Holder** or an **Admin** role.

## Slow prerequisites (read this first)

| Item | How long | Notes |
|---|---|---|
| Individual enrollment | often same day to a few days | Estimate; Apple publishes no timeline. |
| **Organization** enrollment | **weeks** (reports of 10 days to 3+ weeks; unverified) | Needs a legal entity (DBAs are not accepted), a **D-U-N-S number**, a public website on the organization's domain, and someone with legal authority. Apple may phone to verify. |
| D-U-N-S number | up to 5 business days, plus up to 2 for Apple to receive it | Free from Dun & Bradstreet; paying to expedite does not help. |
| App Review | usually under 1 to 2 days; **first submissions of AI-generated apps may take longer or be rejected** | Do not promise yourself a date. |

A first launch is realistically about a week with individual accounts, and 4 to 8 weeks with organization accounts (an unverified estimate). Start enrollment before you need it.

## Steps (App Store Connect key)

1. Open <https://appstoreconnect.apple.com> as the Account Holder or an Admin.
2. Go to **Users and Access → Integrations → App Store Connect API → Team Keys**.
3. Click **Generate API Key** (the **+** button). Name it `Starwisp`. Give it the **Admin** role (EAS needs it to create signing certificates and profiles).
4. Click **Download API Key** next to the new key. Apple lets you download the `.p8` file **only once**. If you lose it, revoke the key and make a new one.
5. Copy the **Key ID** from the key's row and the **Issuer ID** shown above the table.
6. Open <https://developer.apple.com/account> → **Membership details** and copy the **Team ID**.

**Least privilege:** Apple asks for the Admin role here because EAS creates certificates. Revoke the key if you stop using Starwisp. Do not share the `.p8`.

If your Apple account is an **individual** account, tell the factory by setting the repository variable `APPLE_TEAM_TYPE` on `<org>/factory`. Its default is `COMPANY_OR_ORGANIZATION`. The value to use for an individual account is not yet documented here; ask support before changing it.

## Where it goes

Console → **Settings → Vault** → card **App Store Connect API key**:

| Field | Secret |
|---|---|
| **Key ID** | `ASC_API_KEY_ID` |
| **Issuer ID** | `ASC_API_ISSUER_ID` |
| **Private key (.p8)** | `ASC_API_KEY_P8` |
| **Apple Team ID** | `APPLE_TEAM_ID` |

Click **Test now**.

### Optional: push notifications

Card **APNs push key** (secrets `APNS_KEY_ID`, `APNS_KEY_P8`). In Apple Developer → Certificates, IDs & Profiles → Keys, create a key with **Apple Push Notifications service (APNs)** ticked, environment **Sandbox & Production**, **Team Scoped**. Download the `.p8` once. Apple allows two APNs keys per team.

## What it gates

TestFlight uploads and App Store submission (the **ship** stage).

## What it costs

Apple Developer Program: $99 a year (estimate; check Apple's page).

## Rules to know

Each app must be your own distinct idea. Apple rejects template-like or near-duplicate apps. Keep fixes after approval to bug fixes, since over-the-air updates must not change reviewed behavior.
