# Troubleshooting

Problems are grouped by where they show up: the alert, the Feed, the device, the build, publishing, and the App Store Audit. Start with the section that matches what you are seeing.

A tool that helps throughout: the **Developer Updates** screen. `IOSparkleDebugSection` in Settings shows the installed build, the Channel Feed, the exact reason an action is disabled, and buttons for **Check Now** and **Reset Dismissed Update**.

## The alert never appears

Most of the time this is the updater doing its job. Each row below is a deliberate suppression.

| Situation | What you see | What to do |
| --- | --- | --- |
| Running from Xcode in `Debug` | No automatic alert. | Open **Developer Updates** and tap **Check Now** (it fetches and offers the update), or set `allowsAutomaticChecksInDebugBuilds: true`. |
| iOS Simulator | No alert. The action row is disabled with *The Simulator can’t install builds wirelessly.* | Install on a physical device. The Feed is still shown, which is useful for checking layout and metadata. |
| Device below `minimumOSVersion` | No alert. The row is disabled with *Requires iOS 17.0 or later*. | Update the device, or publish a build whose Feed has a lower `minimumOSVersion`. |
| The user tapped **Later** | That build is never offered again, on any later launch. It is remembered per Channel and per bundle identifier, and it survives updates. | **Developer Updates ▸ Reset Dismissed Update**, or publish a newer build: dismissal applies to one build only. |
| Within the throttle interval | Returning to the app within 30 seconds of the last automatic check does not start another one. | Tap **Check Now**, which is never throttled, or wait. |
| Another modal was on screen | The alert is skipped for that check and nothing retries until the next scene activation after the throttle interval. The state is still *Update Available*. | Nothing is wrong. If the app is regularly mid-flow when the check lands, declare it with `isBusy` and present from your own UI at a better moment. |
| Running under XCTest or a UI test (`XCUIApplication`) | No network check and no alert. | Expected. Test your UI with `IOSparkleUpdater.preview(state:)`. |
| `isBusy` returned `true` | No alert. | Expected; the check that found the update still updated `state`. |

When none of the rows applies, the Feed itself is being ignored. The updater never shows an error for that, so check the Feed directly.

## The Feed is ignored or unavailable

**Developer Updates shows *Unavailable*.** The last check failed. In a browser on the same network, open `<channel URL>feed.json`. Then:

| What you find | Cause | Fix |
| --- | --- | --- |
| A login page, `401`, or `403` | The Channel is private. | Configure `feedHeaders` with the credential your gate expects, for example `["Authorization": "Bearer <token>"]`. |
| A redirect | The Host App follows only `https` redirects, and the `iosparkle` tool follows none. | Point `channelURL` at the final `https` address. |
| An error page or `404` | Wrong `channelURL`, or nothing published yet. | `iosparkle verify --channel-url <url>` tells you which step fails. |
| Valid JSON, but a different `bundleId` | The Feed was published for another app or variant. | The Host App ignores a Feed whose `bundleId` is not its own. Publish the right IPA, or fix the Channel URL. For a `.dev` app, the Feed's `bundleId` must be `com.example.myapp.dev`. |
| `"schemaVersion"` greater than `1` | The Feed was written by a newer publisher. | Update iOSparkle. |
| `"schemaVersion": 1.0`, `"build": 118.0`, or a `null` field | Integers must be integer literals and optional fields must be absent, not `null`. | Regenerate the Feed. `iosparkle verify` reports the offending field. |
| The URL starts with `http://` | The Channel URL must be `https`. | Use `https`. The updater makes no request at all otherwise. |

**Developer Updates shows *The Channel Feed hasn’t been loaded yet*.** No check has finished. Tap **Check Now**.

**The Feed is stale after publishing.** A cache between the device and the origin is serving the old `feed.json` or `manifest.plist`. Both must be sent with `Cache-Control: no-store`. The Host App asks for a cacheless fetch, but a CDN does not have to honor that.

**"Open Channel Page" reports *Couldn’t open the Channel page.*** Safari declined the URL, or the Channel URL is not `https`.

## The device will not install

The first thing to know about every item in this section: after the Host App hands the install URL to iOS, the download is performed by the system installer, not by the app. The installer shows its own errors and never reports back to the app.

### It refuses to install over the App Store build

**Symptom.** The device already has the App Store or TestFlight version, and installing the OTA build fails with an *Unable to install* message, or only works after deleting the App Store app and losing its data.

**Cause.** Both builds have the same bundle identifier. iOS installs an OTA package over an existing app only when that app was itself installed with a provisioning profile. An App Store build was not.

**Fix.** Give the app that receives OTA updates its own identifier ending in `.dev`, and publish a matching Channel.

- Dual-Target: set `PRODUCT_BUNDLE_IDENTIFIER` of `MyAppDev` to `com.example.myapp.dev`.
- Single-Target: set `PRODUCT_BUNDLE_IDENTIFIER[config=Debug]` and `PRODUCT_BUNDLE_IDENTIFIER[config=DevOTA]` to `com.example.myapp.dev`.
- The IPA's `CFBundleIdentifier`, the Feed's `bundleId`, and the manifest's `bundle-identifier` must all say `com.example.myapp.dev`. `iosparkle publish` derives all three from the IPA, so archiving the right target with the right configuration is enough.

Both apps then coexist on the device, and every OTA update replaces the previous OTA build in place.

### "Untrusted Developer", or the app will not launch after installing

A build signed for development is not trusted until the device says so.

- After the first launch attempt, open **Settings › General › VPN & Device Management**, select your developer certificate, and tap **Trust**.
- On iOS 16 and later, a development-signed app also needs **Developer Mode**: **Settings › Privacy & Security › Developer Mode**, then restart the device. Xcode offers to enable it when you first run to the device; a build installed over the air cannot do that for you.
- An Ad Hoc profile needs Developer Mode as well.

### The device is missing from the provisioning profile

**Symptom.** The download completes and the installation then fails.

**Cause.** Over-the-air installation works only with a profile that authorizes devices: Development and Ad Hoc profiles list device identifiers; an In-House profile covers all devices.

**Fix.** Register the device's identifier in your developer account, regenerate the profile, archive again, and publish. The identifier is the *Identifier* field of the device in Xcode's **Devices and Simulators** window. Check that the profile has not expired: Development and Ad Hoc profiles expire after 12 months.

### Nothing downloads after tapping Install

**Symptom.** The system dialog appears and the user confirms, but the install ends with an error or stays at *Waiting*.

The installer could not fetch the manifest or the package. It runs in its own process and attaches none of the Host App's headers or cookies and none of the app's certificate exceptions, so check the two URLs with a client that sends nothing:

```sh
curl -sS -o /dev/null -w '%{http_code} %{content_type}\n' https://ota.example.com/my-app-dev/manifest.plist
curl -sS -o /dev/null -r 0-0 -w '%{http_code} %{content_type}\n' https://ota.example.com/my-app-dev/app-118.ipa
```

| `curl` shows | Cause | Fix |
| --- | --- | --- |
| `401` or `403` | The origin expects authentication the installer cannot provide: Basic authentication, a session cookie, a required header. | Serve the manifest and package with no authentication, or use signed short-lived URLs ([Self-Hosting & Private Channels](self-hosting.md)). |
| `200` with `text/html` | A login page or error page is served instead of the manifest, or the manifest is labeled wrongly. | Look at the body. Serve `manifest.plist` as `text/xml`, with no authentication. |
| `302` or `307` for the manifest | A redirect. Some iOS versions mishandle a redirect to a manifest URL with a signed query string. | Serve the manifest with `200` directly. |
| `200` but no `Content-Length`, or `Transfer-Encoding: chunked` | The package is being transformed. | Serve the package as `application/octet-stream` with an exact length, no dynamic compression. |
| A certificate error | The certificate is not trusted by the device. | See the next section. |
| The device is on a private network or VPN | The installer uses the system resolver and the system routes. | Confirm the host is reachable from the device itself. |

The same `curl` commands, run with `-H "Authorization: Bearer …"`, should still work for `feed.json`. That request is the only one the Host App makes, and the only one that can carry a header.

### TLS: private CAs, App Transport Security, Tailscale

**Symptom.** The manifest is reachable from a Mac, but the device never gets past *Waiting*, or Safari on the device warns about the certificate.

The installer applies App Transport Security with the system trust store and none of the Host App's exceptions. `NSAllowsArbitraryLoads` or an `NSExceptionDomains` entry in the app's `Info.plist` changes nothing for it.

- **Self-signed certificate or private CA.** The chain must end in a CA the device trusts. A private root works only if it is installed on every device *and* enabled for full trust under **Settings › General › About › Certificate Trust Settings**. Prefer a certificate from a public CA. For a host that is only reachable through a tunnel, that means an ACME **DNS-01** certificate, which proves ownership through a DNS record and needs no open port.
- **Tailscale.** The iPhone must have the Tailscale app connected, and MagicDNS and HTTPS must be enabled for the tailnet. Test on the device: open `https://<machine>.<tailnet>.ts.net/my-app-dev/feed.json` in Safari. If Safari connects, so can the installer.
- **Old TLS.** TLS 1.2 or later with forward secrecy is required.

To inspect what a host presents:

```sh
openssl s_client -connect ota.example.com:443 -servername ota.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates
```

### `127.0.0.1` never works

The installer refuses to fetch from the device itself. A Channel on your Mac must be reachable by name from the device.

### The app quit, then nothing happened

**Symptom.** The user tapped **Update**, the app closed at once, and the update did not install, or installed only after a long pause.

The app closing immediately is correct: after the system accepts the install request, the updater saves scene restoration state, runs the optional exit hook for at most `exitHookTimeout` (2 seconds by default), and exits so the installer can replace the app. The progress is shown on the Home Screen icon. If the icon stays at *Waiting* or reports an error, the installer could not fetch the manifest or package; see [Nothing downloads after tapping Install](#nothing-downloads-after-tapping-install).

A hook that never completes is capped by the timeout, so it cannot stall the installation. If you need longer than two seconds, raise `exitHookTimeout` deliberately.

## The build fails

| Diagnostic | Cause | Fix |
| --- | --- | --- |
| `main actor-isolated default value in a nonisolated context` | `IOSparkleUpdater` was created as a stored property default in a type that is not `@MainActor`, or as a global `let`. | Create it inside a `@MainActor` type: a SwiftUI `App` or `View`, a `UIResponder` subclass, or a type you mark `@MainActor`. |
| `Undefined symbols` for `...IOSparkle...` when building the shipping target | A source file is gated by `#if canImport(iOSparkle)`, which turns `true` after the development variant has been built into the same products directory. | Gate with `#if IOSPARKLE_ENABLED` (or the project's own development flag) and make sure it is not set for the shipping configuration. |
| `default argument cannot be both main actor-isolated and @concurrent` | A `beforeExitForInstall` closure that awaits off the main actor was written inline inside the `IOSparkleUpdater(…)` call. | Declare the `Configuration` in a separate statement and pass it: see [Writing the exit hook](client-sdk.md#writing-the-exit-hook). |
| `Unable to resolve module dependency: 'iOSparkle'` | The package is referenced by the project but not linked into the target. | The target needs all three: the package reference, the `iOSparkle` product in its *Frameworks, Libraries, and Embedded Content*, and the `iOSparkle` entry of its *Link Binary With Libraries* phase ("iOSparkle in Frameworks" in `project.pbxproj`). |

## Publishing problems

Every message below is printed by the `iosparkle` tool on standard error.

| Message | Cause | Fix |
| --- | --- | --- |
| `feed.json returned HTTP 404` (from `verify`) | Nothing is published at that Channel URL. | Publish first, or correct the URL's path. |
| `feed.json returned HTTP 401` or `403` | The Channel is private. | Add `--header "Authorization: Bearer <token>"`. |
| `feed.json returned HTTP 302` (or another `3xx`) | The URL redirects — often an `http` to `https` jump or a login page. The tool follows no redirects. | Use the final `https` URL. |
| `Could not fetch feed.json: …` | Network, DNS, TLS, or timeout. | Check the host, then raise `--timeout` if it is merely slow. |
| `--channel-url must be an absolute HTTPS URL.` | `publish` needs `https`; the URL has credentials or no host. | Fix the URL. |
| `IPA build 119 must be greater than Channel build 119. Use --force to override.` | The build was already published. | Take the next number from `iosparkle next-build`. |
| `Channel bundleId '…' differs from IPA bundleId '…'. Use --force to override.` | The IPA belongs to another app or variant. | Archive the right target. |
| `IPA SHA-256 mismatch with feed.json.` | A different file is served under `app-<build>.ipa`, or a cache serves an old one. | A package name is immutable: republish under a new build number and purge the cache. |
| `IPA size mismatch. feed.json specifies … bytes, Content-Length is …` | Same as above, or the origin transforms the package. | Same as above. |
| `IPA response requires a positive Content-Length.` | The origin sends no length. | Serve the package as a static `application/octet-stream`. |
| `manifest.plist bundle-identifier does not match feed.json bundleId '…'` | The manifest and Feed were edited separately. | Regenerate both with `publish`. |
| `manifest.plist requires a software-package asset with an absolute HTTPS IPA URL.` | The manifest's package URL is not `https`. | Pass an `https` URL to `--ipa-url`. |
| `An App Store Distribution profile cannot be installed over itms-services://…` | The IPA was exported for the App Store. | Export with the `development` or `release-testing` method. |
| `OTA installation requires a signed iOS build with embedded.mobileprovision.` | The IPA is unsigned. | Export a signed build. |
| `CFBundleVersion must be a positive integer.` | The archive's build number is empty or not numeric. | Set `CURRENT_PROJECT_VERSION`, normally from `iosparkle next-build`. |
| `Existing feed.json is invalid: …. Use --force to replace it.` | A Feed that is not a valid v1 document is already in the Channel. | `--force` if that is intended. |
| `Could not lock Channel directory '…'` | Another publish is running, or one was interrupted and left `.iosparkle-lock-<name>` beside the Channel. | Wait, or remove the stale lock directory once no publish is running. |
| `--ssh requires [user@]host:/remote/dir …` | The `--ssh` target is not an absolute directory path, or contains `..`. | Use `user@host:/absolute/path`. |
| `SSH Channel operation failed …` | `ssh` could not authenticate; it runs in batch mode and never prompts. | Set up key authentication. Test with `ssh -o BatchMode=yes user@host true`. |

## App Store Audit findings

Each finding names the path inside the artifact. All of them mean the same thing: iOSparkle code or metadata reached the shipping build.

| Finding | Meaning | Fix |
| --- | --- | --- |
| `Bundle entry name contains iOSparkle.` | A framework, bundle, or file with iOSparkle in its name is embedded. | Remove the package from the shipping target's *Frameworks* and *Copy Bundle Resources*. |
| `Remove itms-services from LSApplicationQueriesSchemes.` or `… from CFBundleURLTypes/CFBundleURLSchemes.` | An app extension or the app declares the scheme. iOSparkle does not need it. | Delete the declaration. |
| `Found N raw byte match(es) for iosparkle`, `itms-services`, or `download-manifest` | A string literal from iOSparkle was compiled into a shipping binary. | The usual cause is gating with `#if canImport(iOSparkle)` instead of an explicit condition, or leaving `IOSPARKLE_ENABLED` defined for the shipping configuration. Rebuild with `#if IOSPARKLE_ENABLED` defined only for the development variant. |
| `Found iOSparkle symbol '…'` | iOSparkle was linked into the shipping binary; its symbols survive in the dSYM even after stripping. | Remove the package dependency from the shipping target. In the single-target setup, keep `EXCLUDED_SOURCE_FILE_NAMES[config=Release] = iOSparkle.o`. |
| `ProvisionedDevices is present`, `ProvisionsAllDevices is true`, or `get-task-allow is true` | The artifact is a Development, Ad Hoc, or In-House build, not an App Store build. | Archive with App Store signing, or with `CODE_SIGNING_ALLOWED=NO` for an unsigned release archive. |
| `No dSYM bundles found.` | The archive has no symbols to check. | Set *Debug Information Format* to *DWARF with dSYM File* and archive again. |
| `No companion dSYM bundles for this .ipa.` (advisory) | A bare `.ipa` or `.app` was audited without its dSYMs. The check passes but could not run. | Audit the `.xcarchive`. |
| `Expected exactly one .app in Applications; found 0` | The path is not an app archive. | Pass the `.xcarchive` itself, not a folder inside it. |
| `Could not decode embedded.mobileprovision` | The profile is damaged. | Re-archive. |

**The audit fails on a bare `.app` but passes on the archive.** A `.app` from a plain build is unstripped and still contains debug paths. If the checkout directory's name contains `iosparkle`, the raw-byte check matches those paths and fails with `Found N raw byte match(es) for iosparkle`. Audit the `.xcarchive` — its binary is stripped — or strip a copy first, as Xcode does: `xcrun strip -D MyApp.app/MyApp`. Real residue survives stripping; debug paths do not.

**The audit passes when it should fail.** Two things make an audit meaningless:

- The build failed and its incomplete `.app` was audited anyway. A failed link step leaves a bundle without a binary, which has nothing to find. Every `xcodebuild` must exit `0` before its artifact is audited, and stale archives must be deleted first.
- The audit was run on the wrong archive. Confirm with the positive control: `iosparkle audit-appstore build/MyAppDev.xcarchive` must exit non-zero. If it passes, find out why before trusting a pass on the shipping archive.

## Asking for help

When reporting a problem, include: the **Developer Updates** screen (installed build, Channel Feed rows, and any disabled action), the output of `iosparkle verify --channel-url <url>`, the output of `iosparkle audit-appstore` if the App Store Audit is involved, and the two `curl` lines from [Nothing downloads after tapping Install](#nothing-downloads-after-tapping-install). Leave real domains and tokens out; replace them with `ota.example.com`.
