# iOS signing (/docs/builds/ios-signing)



Signed iOS builds need an Apple Distribution certificate and a provisioning profile for the app and for each extension (widgets, share and notification extensions). Liftbay creates them for you.

## Set it up [#set-it-up]

```sh
npx liftbay credentials ios
```

<Steps>
  <Step>
    Sign in with your **Apple ID** and password, then the two-factor code from your devices (or a text message). The password goes only to Apple, from your machine. The session is saved in `~/.liftbay/apple`, readable only by you, so you aren't asked again for a while.
  </Step>

  <Step>
    Pick your **team**. The CLI creates an App Store Connect API key named "Liftbay" and stores it encrypted with your organization.
  </Step>

  <Step>
    Confirm the **bundle ids** to sign. They're detected from `app.json` and the Xcode project: the app and its extensions.
  </Step>

  <Step>
    Liftbay creates (or reuses) the team's distribution certificate and an App Store profile per bundle id, and stores them for the project's builds.
  </Step>
</Steps>

`liftbay build` offers to run this the first time you build iOS without signing.

## Use a .p8 key instead [#use-a-p8-key-instead]

For CI, or if you'd rather not type your Apple password, create a key in App Store Connect (**Users and Access → Integrations → App Store Connect API**, role **Admin**) and pass it in:

```sh
npx liftbay credentials ios --p8 AuthKey_ABC123DEFG.p8 --issuer-id 69a6de7e-… --team-id ABCDE12345
```

The key ID is read from the file name. The issuer ID is shown above the list of keys.

## Certificates [#certificates]

Apple allows only a few distribution certificates per team. Liftbay creates one per team and shares it across your organization's projects, and replaces it 14 days before it expires. If the team is at Apple's limit, the CLI lists the existing certificates and asks which one to revoke; apps already signed with it keep working.

## Ad hoc signing [#ad-hoc-signing]

Internal builds (the `internal` distribution, usually the `preview` profile) are signed with **ad hoc** profiles, so they install directly on your registered test devices without TestFlight. Register devices first ([Internal distribution](/docs/builds/internal-distribution)), then:

```sh
npx liftbay credentials ios --adhoc
```

`liftbay credentials ios` also offers it when your team has registered devices. Liftbay registers new devices with your Apple team and creates an ad hoc profile for the app and each extension with every enabled device.

## Renewal [#renewal]

Before each signed iOS build, Liftbay re-creates the project's profiles when:

* they expire within 7 days,
* the team's certificate was replaced or revoked,
* (ad hoc) devices were added, re-enabled or disabled since the profiles were made.

The build log says what was renewed. You don't need to run anything.

## Without signing [#without-signing]

A store build without App Store signing, or an internal build without ad hoc signing, produces a **simulator build** (`.app`) instead, which you can run in the iOS Simulator.

## Troubleshooting [#troubleshooting]

| Message                 | What to do                                                                                                |
| ----------------------- | --------------------------------------------------------------------------------------------------------- |
| Agreement required      | The Account Holder must accept the latest agreement in App Store Connect.                                 |
| API access not enabled  | The Account Holder must request access once: **Users and Access → Integrations → App Store Connect API**. |
| Not an admin            | Sign in with an Apple ID that has the Admin role on the team.                                             |
| A target has no profile | Run `liftbay credentials ios` again, or pass the missing id with `--bundle-id`.                           |

## Remove [#remove]

* `liftbay credentials ios --sign-out --apple-id you@example.com` deletes the saved Apple session.
* Revoke the "Liftbay" key in App Store Connect to cut Liftbay's access to your Apple account.
