# The App Store

> What CI builds for iOS — the engine and a simulator build of the app — and why archiving, signing and TestFlight are left to Xcode on a Mac.

Source: https://omardev29.github.io/rmp-docs/publishing/app-store.html

CI builds the iOS engine and a simulator build of your game, and checks the app it made. It does not archive, sign or upload anything to Apple, and that is deliberate: an app a phone will install has to be signed, and signing needs an Apple developer account and credentials that do not belong in CI. The step from a working build to TestFlight and the App Store is made in Xcode, on a Mac, from a project the framework generates.

## What CI builds

iOS is in the full matrix: it builds on a tag, and on a run started with `full`, on a macOS runner with its Xcode version pinned. The job:

1. builds `raylib.xcframework`, for devices and for the simulator, from the raylib-iOS fork pinned as the submodule `thirdparty/raylib-ios` — upstream raylib has no iOS backend, and the fork draws through ANGLE, OpenGL ES on top of Metal;
2. generates the Xcode project from `raylib_multiplatform.toml`;
3. builds the app for the simulator, without signing;
4. checks what it built: the executable is a Mach-O, the bundle's `Info.plist` has a readable bundle identifier, and your `resources/` folder is inside the bundle.

Two files go to the release from it: `ios-raylib-xcframework.zip`, the engine, and `ios-app-simulator.zip`, the app. The app is a debug build for the simulator, unsigned; it runs in the iOS Simulator and cannot be installed on a phone.

Starting the app in the simulator is part of the job and switched off: the simulator on the pinned runner does not come up reliably, and a step that is known not to work is off rather than allowed to fail quietly. Set the repository variable `IOS_SIMULATOR_TEST` to `true` to try it; it then installs the app, runs it, and requires the same boot and render markers as every other platform.

### Trying the simulator build

On a Mac with Xcode, from the release's `ios-app-simulator.zip`:

```shell
unzip ios-app-simulator.zip
xcrun simctl boot "iPhone 16"
open -a Simulator
xcrun simctl install booted my_game.app
xcrun simctl launch --console booted com.yourname.yourgame
```

## What CI does not do, and why

Archiving, signing, TestFlight and submitting to the App Store are not automated. Apple only installs a signed app on a device, and signing takes a paid Apple Developer account, a provisioning profile and a certificate. Those cannot live in a public repository, and the framework does not ask for them as secrets either: the release path that touches Apple's credentials runs in Xcode, on your Mac, under your account.

For the same reason the iOS app is never run on Firebase Test Lab: Test Lab needs a signed `.ipa` for iOS.

## Onto a phone, and to the App Store

On a Mac with Xcode and [an Apple developer account](https://developer.apple.com/), from your game's folder:

1. **Fetch the fork.** A game made with `rmp new` has the submodule registered and not checked out, since only iOS needs it:
   ```shell
   git submodule update --init thirdparty/raylib-ios
   ```
2. **Build the engine**, `raylib.xcframework` with its device and simulator slices, the same way CI does. Once, and again only when the submodule moves:
   ```shell
   (cd thirdparty/raylib-ios/projects/scripts && bash build-ios-xcframework.sh)
   ```
3. **Set your team in the .toml**, rather than in Xcode, so it survives the next time the project is generated. `[ios.settings]` is copied into the Xcode project as build settings, word for word:
   raylib_multiplatform.toml
   ```toml
   [ios.settings]
   DEVELOPMENT_TEAM = "ABCDE12345"
   CODE_SIGN_STYLE  = "Automatic"
   ```
4. **Generate the project** and open it. `tools/configure.py` writes `ios/project.yml`, and XcodeGen turns that into the Xcode project — CI uses the XcodeGen version pinned in `thirdparty/FROZEN_VERSIONS.md`:
   ```shell
   python3 tools/configure.py
   cd ios && xcodegen generate
   open my_game.xcodeproj
   ```
5. **Run it on your phone**: select the device and press Run.
6. **Archive it for TestFlight and the App Store** from Xcode, with *Product → Archive*, and upload the archive from there.

The Xcode project is generated, so a change made to it by hand in Xcode is gone the next time it is generated; whatever the project needs belongs in `[ios]`, `[ios.settings]` or the rest of the .toml.

## What the generated project sets

| In the app | From |
|---|---|
| Bundle identifier | `[ios] bundle_id`. Like Android's id, a placeholder `com.example.` id is refused for a release. |
| Oldest iOS | `[ios] deployment_target`, `"15.6"` by default and no lower than 13.0: `rmp::save` uses `std::filesystem`, which Apple's C++ library has from iOS 13. |
| Version | The tag: `v1.2.0` becomes the marketing version `1.2.0`. The generator sets no build number; Xcode's `CURRENT_PROJECT_VERSION` can be given in `[ios.settings]` like any other build setting. |
| Name under the icon | `[window] title`. |
| Orientations | `[window] orientation`, the same setting Android reads. |
| Icon | `[icon] source`, as the app's icon set. |
| Launch screen | A plain one generated by Xcode. An app without a launch screen runs letterboxed at an old resolution, and App Review rejects it. |
| Full screen, no status bar, arm64 only | Fixed. |
| Assets | Your `resources/` folder, copied into the bundle as a folder. The app changes into its bundle before it loads anything, so the same relative paths work as on a desktop. |
| Licence notices | `LICENSES.txt` at the root of the bundle, crediting the raylib-iOS fork and ANGLE too. Writing it needs the submodule checked out; without it, a configuration on your machine warns and writes no iOS notice, and the iOS job in CI refuses to go on. |
| Designated initialisers | Out of declaration order, an error, as in every other build: the project's `OTHER_CPLUSPLUSFLAGS` carry `-Werror=reorder-init-list`, since Clang only warns where GCC refuses. An `OTHER_CPLUSPLUSFLAGS` of your own in `[ios.settings]` is kept, after it. |

raylib_multiplatform.toml

```toml
[ios]
deployment_target = "12.0"
```

```text
  raylib_multiplatform.toml:2: deployment_target = "12.0"
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^

  configure: error: [ios] deployment_target = '12.0' is below 13.0.
                    rmp::save uses std::filesystem, which Apple's C++ library only has from iOS 13. Use 13.0 or later; the default, 15.6, covers every iPhone Apple still updates.
```

## What is different on iOS

- **The game cannot quit itself.** Apple's guidance is that an iOS app that terminates itself appears to the player to have crashed, and App Review rejects that. [`rmp::app::quit()`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-app.html#quit) logs a warning and does nothing on iOS, so the same source ships everywhere and a Quit button is simply inert on a phone. Hide it there if a dead button bothers you:
  ```cpp
  #if !defined(PLATFORM_IOS)
  if (rmp::ui::button("Quit")) rmp::app::quit();
  #endif
  ```
- **raylib is prebuilt.** The app links the fork's `raylib.xcframework`, so `[raylib] disabled_modules` changes nothing on iOS.
- **No ads.** [`rmp::ads`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-ads.html) does nothing on iOS; ads are implemented for Android only.
- **The frame is paced by the display.** `[window] fps` is ignored on iOS.

## Keeping up with Xcode

Apple requires submissions to be built with a recent Xcode and SDK, and raises that bar about once a year. Building with a newer Xcode means updating the raylib-iOS fork and the ANGLE it bundles to one that supports it, and moving the Xcode pin in `thirdparty/FROZEN_VERSIONS.md`, which is where CI reads the runner and the Xcode version from.
