<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MacBuildCloud Blog]]></title><description><![CDATA[Practical tutorials on iOS builds, code signing, TestFlight and mobile CI/CD for Flutter, React Native and Unity developers.]]></description><link>https://macbuildcloud.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 21:28:30 GMT</lastBuildDate><atom:link href="https://macbuildcloud.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Your first TestFlight build from Windows: every step, in order (Flutter)]]></title><description><![CDATA[I'm on the MacBuildCloud team; we run Mac build machines, and "how do I get my Flutter app onto TestFlight without a Mac?" is the question we hear most…]]></description><link>https://macbuildcloud.hashnode.dev/your-first-testflight-build-from-windows-every-step-in-order-flutter</link><guid isPermaLink="true">https://macbuildcloud.hashnode.dev/your-first-testflight-build-from-windows-every-step-in-order-flutter</guid><category><![CDATA[iOS]]></category><category><![CDATA[Flutter]]></category><category><![CDATA[github-actions]]></category><category><![CDATA[testflight]]></category><dc:creator><![CDATA[MacBuildCloud]]></dc:creator><pubDate>Wed, 02 Dec 2026 07:35:38 GMT</pubDate><content:encoded><![CDATA[<p><em>I'm on the MacBuildCloud team; we run Mac build machines, and "how do I get my Flutter app onto TestFlight without a Mac?" is the question we hear most. This guide doesn't use our service: it uses a free GitHub-hosted macOS runner, and everything else happens in a browser and a Windows terminal.</em></p>
<p><em>Originally published on DEV: <a href="https://dev.to/macbuildcloud/your-first-testflight-build-from-windows-every-step-in-order-flutter-51bn">https://dev.to/macbuildcloud/your-first-testflight-build-from-windows-every-step-in-order-flutter-51bn</a> . This article was written with the help of AI and checked against Apple's App Store Connect and developer account help, the GitHub Actions documentation and the Flutter documentation.</em></p>
<p>People who build iOS apps from Windows usually don't get stuck on Flutter. They get stuck on the Apple side: which page has which file, what has to exist before what, and why the build fails with a message that doesn't mention the real problem. Here is the whole path, in the order Apple needs it.</p>
<h2>What you need</h2>
<ul>
<li>A <strong>paid Apple Developer Program membership</strong>. A free Apple ID can't create a distribution certificate. Sign in as the Account Holder or an Admin of the team.</li>
<li>A Flutter app in a <strong>GitHub repository</strong>. GitHub's standard macOS runners are free for public repositories; on a private repository they use your Actions minutes, and macOS minutes cost more than Linux ones.</li>
<li><strong>OpenSSL</strong> on Windows. Git for Windows ships one: open Git Bash and run <code>openssl version</code>.</li>
</ul>
<p>Two Apple websites are involved, and they're easy to mix up:</p>
<ul>
<li><strong>developer.apple.com</strong> → Account → Certificates, Identifiers &amp; Profiles: App ID, certificate, provisioning profile.</li>
<li><strong>appstoreconnect.apple.com</strong>: the app record, the API key, TestFlight.</li>
</ul>
<h2>1. Pick a bundle ID and put it in the project</h2>
<p>Choose a reverse-domain ID like <code>com.yourname.yourapp</code>. You can't change it after the first upload.</p>
<p>Without Xcode, edit <code>ios/Runner.xcodeproj/project.pbxproj</code> in any text editor. Search for <code>PRODUCT_BUNDLE_IDENTIFIER</code>: the Runner target has three entries (Debug, Release, Profile). Change those to your ID. The <code>RunnerTests</code> entries end in <code>.RunnerTests</code>; give them your ID plus <code>.RunnerTests</code>.</p>
<h2>2. Register the App ID</h2>
<p>developer.apple.com → Certificates, Identifiers &amp; Profiles → <strong>Identifiers</strong> → <strong>+</strong> → App IDs → App. Enter the exact bundle ID from step 1 as an <strong>explicit</strong> ID (not a wildcard). Tick any capabilities your app uses, such as Push Notifications.</p>
<h2>3. Create the app record</h2>
<p>appstoreconnect.apple.com → <strong>Apps</strong> → <strong>+</strong> → New App. Pick iOS, a name, a language, your bundle ID from the list, and any SKU (it's only for you). If your bundle ID isn't in the list, step 2 didn't save, or you're on the wrong team (check the team selector at the top right).</p>
<h2>4. Make a distribution certificate on Windows</h2>
<p>Apple's instructions assume Keychain Access on a Mac. OpenSSL does the same job. In Git Bash:</p>
<pre><code class="language-bash">openssl req -new -newkey rsa:2048 -nodes \
  -keyout ios_distribution.key \
  -out ios_distribution.csr \
  -subj "/emailAddress=you@example.com/CN=Your Name/C=US"
</code></pre>
<p>Keep <code>ios_distribution.key</code> safe. Without it, the certificate Apple gives you is useless.</p>
<p>On developer.apple.com → <strong>Certificates</strong> → <strong>+</strong> → <strong>Apple Distribution</strong>, upload <code>ios_distribution.csr</code> and download the <code>.cer</code>. Then combine the key and the certificate into a <code>.p12</code>:</p>
<pre><code class="language-bash">openssl x509 -inform DER -in distribution.cer -out distribution.pem
openssl pkcs12 -export -legacy \
  -inkey ios_distribution.key \
  -in distribution.pem \
  -out distribution.p12
</code></pre>
<p>It asks for a password; you'll need it in step 8. About <code>-legacy</code>: OpenSSL 3 changed how <code>.p12</code> files are protected, and older versions of macOS reject the new format with "MAC verification failed ... (wrong password?)" even when the password is right. Apple fixed this in macOS 15, but <code>-legacy</code> makes a file that every version accepts. If your OpenSSL is older than 3 and doesn't know <code>-legacy</code>, just leave it out.</p>
<p>Apple limits how many distribution certificates a team can have. Make one, keep the <code>.p12</code> and its password somewhere safe, and reuse it for every build.</p>
<h2>5. Create the provisioning profile</h2>
<p>developer.apple.com → <strong>Profiles</strong> → <strong>+</strong> → Distribution → <strong>App Store Connect</strong>. Pick your App ID, then the certificate from step 4, give the profile a name you'll remember, and download the <code>.mobileprovision</code>. You'll type that name in step 7.</p>
<h2>6. Create an App Store Connect API key</h2>
<p>appstoreconnect.apple.com → <strong>Users and Access</strong> → <strong>Integrations</strong> → App Store Connect API → <strong>+</strong>. Give it the <strong>App Manager</strong> role. Note three things:</p>
<ul>
<li>the <strong>Issuer ID</strong> at the top of the page,</li>
<li>the <strong>Key ID</strong> in the key's row,</li>
<li>the <strong><code>.p8</code> file</strong>. Apple lets you download it <strong>once</strong>. Keep it.</li>
</ul>
<h2>7. Add ExportOptions.plist</h2>
<p>Create <code>ios/ExportOptions.plist</code>. It's plain text, so any editor works:</p>
<pre><code class="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;method&lt;/key&gt;          &lt;string&gt;app-store-connect&lt;/string&gt;
  &lt;key&gt;teamID&lt;/key&gt;          &lt;string&gt;YOURTEAMID&lt;/string&gt;
  &lt;key&gt;signingStyle&lt;/key&gt;    &lt;string&gt;manual&lt;/string&gt;
  &lt;key&gt;provisioningProfiles&lt;/key&gt;
  &lt;dict&gt;
    &lt;key&gt;com.yourname.yourapp&lt;/key&gt;&lt;string&gt;Your Profile Name&lt;/string&gt;
  &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
<p><code>teamID</code> is the 10-character Team ID shown on developer.apple.com under Membership details. The profile value is the profile's <strong>name</strong> from step 5, not its filename.</p>
<p>While you're in <code>ios/</code>, open <code>ios/Runner/Info.plist</code>. If your app only uses standard HTTPS, add this inside the main <code>&lt;dict&gt;</code> so App Store Connect stops asking the encryption question for every build:</p>
<pre><code class="language-xml">&lt;key&gt;ITSAppUsesNonExemptEncryption&lt;/key&gt;
&lt;false/&gt;
</code></pre>
<h2>8. Build and upload with GitHub Actions</h2>
<p>First turn the binary files into text, because GitHub secrets are text. In PowerShell:</p>
<pre><code class="language-powershell">[Convert]::ToBase64String([IO.File]::ReadAllBytes("distribution.p12")) | Set-Content p12.txt
[Convert]::ToBase64String([IO.File]::ReadAllBytes("Your_Profile.mobileprovision")) | Set-Content profile.txt
[Convert]::ToBase64String([IO.File]::ReadAllBytes("AuthKey_ABC123XYZ.p8")) | Set-Content p8.txt
</code></pre>
<p>In your repository → Settings → Secrets and variables → Actions, add:</p>
<table>
<thead>
<tr>
<th>Secret</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td><code>P12_BASE64</code></td>
<td>contents of <code>p12.txt</code></td>
</tr>
<tr>
<td><code>P12_PASSWORD</code></td>
<td>the password from step 4</td>
</tr>
<tr>
<td><code>PROFILE_BASE64</code></td>
<td>contents of <code>profile.txt</code></td>
</tr>
<tr>
<td><code>ASC_KEY_BASE64</code></td>
<td>contents of <code>p8.txt</code></td>
</tr>
<tr>
<td><code>ASC_KEY_ID</code></td>
<td>the Key ID</td>
</tr>
<tr>
<td><code>ASC_ISSUER_ID</code></td>
<td>the Issuer ID</td>
</tr>
<tr>
<td><code>KEYCHAIN_PASSWORD</code></td>
<td>any random string</td>
</tr>
</tbody></table>
<p>Then add <code>.github/workflows/testflight.yml</code>:</p>
<pre><code class="language-yaml">name: TestFlight
on:
  workflow_dispatch:

jobs:
  build:
    runs-on: macos-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v4
      - uses: subosito/flutter-action@v2
        with:
          channel: stable

      - name: Install certificate and profile
        env:
          P12_BASE64: ${{ secrets.P12_BASE64 }}
          P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
          PROFILE_BASE64: ${{ secrets.PROFILE_BASE64 }}
          KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
        run: |
          KEYCHAIN=$RUNNER_TEMP/build.keychain-db
          echo -n "$P12_BASE64" | base64 --decode -o $RUNNER_TEMP/cert.p12
          echo -n "$PROFILE_BASE64" | base64 --decode -o $RUNNER_TEMP/app.mobileprovision
          security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN
          security set-keychain-settings -lut 21600 $KEYCHAIN
          security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN
          security import $RUNNER_TEMP/cert.p12 -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN
          security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN
          security list-keychain -d user -s $KEYCHAIN
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp $RUNNER_TEMP/app.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
          mkdir -p ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles
          cp $RUNNER_TEMP/app.mobileprovision ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles/

      - name: Build
        run: |
          flutter build ipa --release --no-codesign --build-number=${{ github.run_number }}
          xcodebuild -exportArchive \
            -archivePath build/ios/archive/Runner.xcarchive \
            -exportOptionsPlist ios/ExportOptions.plist \
            -exportPath build/ios/ipa

      - name: Upload to TestFlight
        env:
          ASC_KEY_BASE64: ${{ secrets.ASC_KEY_BASE64 }}
          ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
          ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
        run: |
          mkdir -p ~/.appstoreconnect/private_keys
          echo -n "$ASC_KEY_BASE64" | base64 --decode -o ~/.appstoreconnect/private_keys/AuthKey_$ASC_KEY_ID.p8
          IPA=$(ls build/ios/ipa/*.ipa | head -n 1)
          xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$ASC_KEY_ID" --apiIssuer "$ASC_ISSUER_ID"
</code></pre>
<p>Push it, then go to the <strong>Actions</strong> tab and press <strong>Run workflow</strong>. (The button only appears once the file is on the default branch.)</p>
<p>Two choices in that file are deliberate:</p>
<ul>
<li><strong>The archive isn't signed; the export is.</strong> <code>--no-codesign</code> builds the archive without touching signing, and <code>-exportArchive</code> signs it with your certificate and profile. If you let automatic signing run on a fresh runner instead, Xcode asks Apple for a new certificate every time, and the private key disappears with the runner.</li>
<li><strong><code>--build-number</code> uses the run number</strong>, because App Store Connect rejects a build number it has already seen.</li>
</ul>
<h2>9. Find it in TestFlight</h2>
<p>After the upload, App Store Connect → your app → <strong>TestFlight</strong>. The build shows as Processing for a few minutes. Then:</p>
<ul>
<li><strong>Internal testers</strong> (people on your App Store Connect team, up to 100) can install it right away, with no review.</li>
<li><strong>External testers</strong> need Beta App Review, but only for the first build you add to an external group.</li>
</ul>
<p>Your testers install the TestFlight app on their iPhone and accept the invite.</p>
<h2>Where it usually breaks</h2>
<table>
<thead>
<tr>
<th>Message</th>
<th>What it usually means</th>
</tr>
</thead>
<tbody><tr>
<td>Bundle ID not in the New App list</td>
<td>The App ID from step 2 is missing, is a wildcard, or is on another team</td>
</tr>
<tr>
<td><code>MAC verification failed ... (wrong password?)</code></td>
<td>The <code>.p12</code> was made by OpenSSL 3 without <code>-legacy</code></td>
</tr>
<tr>
<td><code>No signing certificate "iOS Distribution" found</code></td>
<td>The <code>.p12</code> has no private key in it, or the certificate expired</td>
</tr>
<tr>
<td><code>No profiles for 'com...' were found</code></td>
<td>Bundle ID in the project doesn't match the profile, or an app extension needs its own profile</td>
</tr>
<tr>
<td><code>Provisioning profile doesn't include signing certificate</code></td>
<td>The profile was made with another certificate; make the profile again</td>
</tr>
<tr>
<td>Upload rejected for the key's permissions</td>
<td>The API key's role is below App Manager</td>
</tr>
<tr>
<td>Upload rejected for the build number</td>
<td>That build number was already uploaded</td>
</tr>
</tbody></table>
<p>If your app embeds a native framework of its own (Kotlin Multiplatform, for example) and the upload is rejected with ITMS-90035, that framework wasn't signed at export. Signing during the archive step, with the same certificate and profile, is the usual way around it.</p>
<h2>Checklist</h2>
<ul>
<li>Paid membership, signed in as Account Holder or Admin</li>
<li>Bundle ID set in <code>project.pbxproj</code>, registered as an explicit App ID, and used for the app record</li>
<li><code>.p12</code> made with <code>-legacy</code>, and its password saved</li>
<li>App Store provisioning profile for that App ID and certificate</li>
<li>API key with App Manager role; <code>.p8</code>, Key ID and Issuer ID saved</li>
<li><code>ExportOptions.plist</code> with your Team ID and the profile's name</li>
<li>Workflow on the default branch, started from <strong>Run workflow</strong></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Nightly, on-demand and release iOS builds with GitHub Actions: the parts that bit us]]></title><description><![CDATA[Nightly, on-demand and release iOS builds in GitHub Actions, and the catches: UTC cron, default branch, double push builds, fork secrets.]]></description><link>https://macbuildcloud.hashnode.dev/nightly-on-demand-and-release-ios-builds-with-github-actions-the-parts-that-bit-us</link><guid isPermaLink="true">https://macbuildcloud.hashnode.dev/nightly-on-demand-and-release-ios-builds-with-github-actions-the-parts-that-bit-us</guid><category><![CDATA[github-actions]]></category><category><![CDATA[iOS]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[MacBuildCloud]]></dc:creator><pubDate>Tue, 01 Dec 2026 08:00:05 GMT</pubDate><content:encoded><![CDATA[<p><em>I'm on the MacBuildCloud team; we run Mac build machines. This week we wrote a GitHub Action that starts a build on a remote machine and waits for it, and these are the things we had to get right. None of it depends on our product: it applies to any workflow that kicks off an iOS build, on a GitHub-hosted macOS runner or somewhere else.</em></p>
<p><em>Originally published on DEV: <a href="https://dev.to/macbuildcloud/nightly-on-demand-and-release-ios-builds-with-github-actions-the-parts-that-bit-us-40a9">https://dev.to/macbuildcloud/nightly-on-demand-and-release-ios-builds-with-github-actions-the-parts-that-bit-us-40a9</a> . This article was written with the help of AI and checked against the GitHub Actions documentation and our own work on the action described above.</em></p>
<h2>Why not just build on every push?</h2>
<p>For most apps, a full iOS build on every push is more than you need. What people usually want is:</p>
<ul>
<li>a <strong>nightly</strong> build, so someone notices when the main branch stops compiling,</li>
<li>a <strong>button</strong> to build any branch on demand,</li>
<li>a build when a <strong>release is published</strong>.</li>
</ul>
<p>GitHub Actions has a trigger for each. Each one also has a catch.</p>
<h2>1. Nightly: <code>schedule</code></h2>
<pre><code class="language-yaml">on:
  schedule:
    - cron: '0 18 * * 1-5'
</code></pre>
<p>Things the docs say that are easy to miss:</p>
<ul>
<li><strong>It only runs on the default branch</strong>, on its latest commit. You can't schedule a nightly build of <code>develop</code> from a workflow that only lives on <code>develop</code>.</li>
<li><strong>The time is UTC by default.</strong> The example above is 18:00 UTC. GitHub now lets you set an IANA <code>timezone</code> per cron entry if you would rather think in local time.</li>
<li><strong>Runs can be late.</strong> GitHub says scheduled runs may be delayed when load is high, and the start of every hour is a high-load time. Under heavy load some queued runs can be dropped. Pick an odd minute like <code>17</code> instead of <code>0</code>.</li>
<li><strong>The shortest interval is every 5 minutes</strong>, and the <code>@daily</code> style shortcuts aren't supported.</li>
<li><strong>In a public repository, scheduled workflows switch themselves off</strong> after 60 days with no repository activity. A quiet side project's nightly build can simply stop.</li>
</ul>
<h2>2. On demand: <code>workflow_dispatch</code></h2>
<pre><code class="language-yaml">on:
  workflow_dispatch:
</code></pre>
<p>This adds a <strong>Run workflow</strong> button on the Actions tab, where you can pick a branch. The catch: <strong>the workflow file has to be on the default branch</strong> before the button appears. Adding it on a feature branch and wondering where the button went is a rite of passage.</p>
<h2>3. On release: <code>release</code></h2>
<pre><code class="language-yaml">on:
  release:
    types: [published]
</code></pre>
<p>Without <code>types</code>, every release activity triggers the workflow, so drafts and edits start builds too. <code>published</code> is usually the one you want.</p>
<h2>4. Don't build the same push twice</h2>
<p>This is the one that would have cost our users money.</p>
<p>A lot of build services, ours included, can already build every push through a GitHub App or a webhook, and report back as a check on the commit. If you then also add a workflow that starts a build <code>on: push</code>, <strong>every push is built twice, and on a metered service, billed twice</strong>. Nothing fails; you only find out from the bill.</p>
<p>So decide where push builds come from:</p>
<ul>
<li>If the service already builds every push, keep your workflow to <code>schedule</code>, <code>workflow_dispatch</code> and <code>release</code>.</li>
<li>If you want Actions to decide, for example only build after your tests pass with <code>needs:</code>, turn off the push builds on the service side.</li>
</ul>
<p>Our own example repositories ship a workflow with only <code>workflow_dispatch</code> for exactly this reason.</p>
<h2>5. If the workflow starts a remote build, make it behave like a local one</h2>
<p>If your workflow hands the build to an external service rather than running <code>xcodebuild</code> itself, three things matter:</p>
<p><strong>Wait and fail properly.</strong> Starting the build and finishing the job green is the default mistake. Poll until the remote build ends, and exit non-zero if it failed, so the run turns red and branch protection means something. Print a link to the remote build page so whoever is looking at the red run can find the log.</p>
<p><strong>Cancel what you started.</strong> If someone cancels the workflow run, or the job hits its timeout, the remote build keeps going unless you cancel it yourself. On a service billed by time, that is a machine running for nobody. Trap the cancellation in your step and call the service's cancel endpoint, and set your own time limit on the wait as well.</p>
<p><strong>Expect empty secrets on forks.</strong> GitHub doesn't pass secrets (other than <code>GITHUB_TOKEN</code>) to workflows triggered by pull requests from forks. Your API token will be an empty string there. Check for that and fail with a clear message instead of a confusing 401 three steps later.</p>
<h2>A minimal shape</h2>
<pre><code class="language-yaml">name: iOS build
on:
  schedule:
    - cron: '17 18 * * 1-5'
  workflow_dispatch:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest   # the Mac work happens on the remote side
    timeout-minutes: 70
    steps:
      - name: Start remote build and wait
        env:
          BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
        run: |
          if [ -z "$BUILD_TOKEN" ]; then
            echo "BUILD_TOKEN is empty (fork pull request, or the secret is missing)"; exit 1
          fi
          ./scripts/start-and-wait.sh   # start, poll, cancel on TERM, exit non-zero on failure
</code></pre>
<p>If you build on a GitHub-hosted macOS runner instead, drop the remote part. The triggers and the gotchas in sections 1 to 4 are the same.</p>
<h2>Checklist</h2>
<ul>
<li>Nightly uses <code>schedule</code>, on the default branch, at an odd minute, in a time zone you set on purpose.</li>
<li>The <strong>Run workflow</strong> button exists because the file is on the default branch.</li>
<li>Release builds use <code>types: [published]</code>.</li>
<li>Push builds come from exactly one place.</li>
<li>A remote build is waited for, fails the run when it fails, and is cancelled when the run is.</li>
<li>Fork pull requests get a clear "token is empty" message.</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Why your CI keeps creating iOS certificates (and how to stop it)]]></title><description><![CDATA[Automatic signing with -allowProvisioningUpdates on a throwaway CI Mac creates a new certificate every run. Here is why, and four fixes.]]></description><link>https://macbuildcloud.hashnode.dev/why-your-ci-keeps-creating-ios-certificates-and-how-to-stop-it</link><guid isPermaLink="true">https://macbuildcloud.hashnode.dev/why-your-ci-keeps-creating-ios-certificates-and-how-to-stop-it</guid><category><![CDATA[iOS]]></category><category><![CDATA[Xcode]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[fastlane]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[MacBuildCloud]]></dc:creator><pubDate>Tue, 24 Nov 2026 02:26:10 GMT</pubDate><content:encoded><![CDATA[<p><em>I'm on the MacBuildCloud team. We run Mac build machines, and this is a bug we shipped into our own pipeline and then took back out. Nothing here depends on our product; every fix below works on GitHub Actions, a self-hosted runner, or any CI that throws its Mac away after each job.</em></p>
<p><em>This post was written with the assistance of AI and checked against our own build logs and the official Apple, GitHub and fastlane documentation. It was first published on <a href="https://dev.to/macbuildcloud/why-your-ci-keeps-creating-ios-certificates-and-how-to-stop-it-278e">DEV</a>.</em></p>
<h2>The symptom</h2>
<p>Open developer.apple.com, go to <strong>Certificates</strong>, and look for entries named like this:</p>
<blockquote>
<p>Apple Development: Created via API</p>
</blockquote>
<p>If you see one you don't remember making, and especially if you see several, there is a good chance a CI job made them.</p>
<p>We found ours during our own TestFlight test. The build passed. The <code>.ipa</code> was fine. Then we checked the team's certificate list and there was a new development certificate that nobody had asked for.</p>
<h2>Why it happens</h2>
<p>Three things combine:</p>
<ol>
<li><strong>The project uses automatic signing.</strong> That's the Xcode default, so most projects do.</li>
<li><strong>The build runs <code>xcodebuild archive</code> with <code>-allowProvisioningUpdates</code></strong> plus an App Store Connect API key. This is the common advice for "signing without a Mac", and it does work.</li>
<li><strong>The build machine is brand new every time.</strong> A fresh VM or a hosted runner has an empty keychain.</li>
</ol>
<p>During <code>archive</code>, automatic signing wants a <em>development</em> identity on the machine. There isn't one, and <code>-allowProvisioningUpdates</code> tells Xcode it may fix that. So it generates a private key in the VM's keychain and asks Apple for a new development certificate to match.</p>
<p>Then the job ends and the VM is deleted, private key and all.</p>
<p>The certificate is still listed in your account, but nothing anywhere can sign with it any more, because the key that goes with it is gone. The next run starts with an empty keychain again and has the same problem.</p>
<p>We stopped after the first one, so I can't show you a screenshot of fifty. But nothing about the next run can reuse a certificate whose private key was destroyed. At best you collect clutter that makes it hard to tell which certificate is real. Apple's documentation doesn't publish a number for how many development certificates a team can hold, so I won't guess one; it isn't a pile you want to find out about.</p>
<p>The CI is also quietly holding a key that can create certificates in your team. Most build jobs don't need that.</p>
<h2>Fix 1: don't sign at archive time</h2>
<p>This is the change that fixed it for us, and it's small. Archive <strong>without</strong> signing, then sign once, at export:</p>
<pre><code class="language-bash">xcodebuild \
  -workspace MyApp.xcworkspace -scheme MyApp \
  -destination "generic/platform=iOS" \
  -archivePath build/MyApp.xcarchive \
  CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" \
  archive

xcodebuild -exportArchive \
  -archivePath build/MyApp.xcarchive \
  -exportOptionsPlist ExportOptions.plist \
  -exportPath build/ipa
</code></pre>
<p>The export step needs a distribution certificate and an App Store profile, which is the part you were going to need anyway. No development identity is involved, so there is nothing for Xcode to invent.</p>
<p><strong>Update: a case we hadn't tested.</strong> Our app had a widget extension, and signing at export worked. Nesim Razon tried this with a Kotlin Multiplatform framework embedded in the app: the framework stayed unsigned and App Store Connect rejected the upload with error 90035 (Invalid Signature). If your app embeds frameworks, check the exported .ipa before uploading, or go straight to Option A below, which is what fixed it for him. Thanks, Nesim.</p>
<p><code>ExportOptions.plist</code> is a plain text file you can write on any OS:</p>
<pre><code class="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;method&lt;/key&gt; &lt;string&gt;app-store-connect&lt;/string&gt;
  &lt;key&gt;teamID&lt;/key&gt; &lt;string&gt;YOURTEAMID&lt;/string&gt;
  &lt;key&gt;signingStyle&lt;/key&gt; &lt;string&gt;manual&lt;/string&gt;
  &lt;key&gt;provisioningProfiles&lt;/key&gt;
  &lt;dict&gt;
    &lt;key&gt;com.example.myapp&lt;/key&gt;&lt;string&gt;MyApp AppStore&lt;/string&gt;
  &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
<p>The value under <code>provisioningProfiles</code> is the profile's name as Apple shows it, not the filename. If the app has extensions (a widget, a share extension, a watch app), each bundle ID needs its own entry and its own profile. Ours had a widget, and a missing widget profile is the error that's easiest to misread, because the message names the extension's bundle ID, not the app's.</p>
<p>For Flutter it's the same idea: <code>flutter build ipa --no-codesign</code> (or <code>flutter build ios --no-codesign</code> plus your own archive step), then <code>-exportArchive</code>.</p>
<p>Now you need to get that distribution certificate onto the machine. There are a few honest ways, with different trade-offs.</p>
<h2>Option A: a .p12 in your CI secrets</h2>
<p>Export your Apple Distribution certificate <strong>with its private key</strong> as a <code>.p12</code>, store it as a secret, and import it into a throwaway keychain at the start of each job. GitHub's documentation has a complete example; the core of it is:</p>
<pre><code class="language-bash">security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
</code></pre>
<p>Then copy the <code>.mobileprovision</code> into the profiles directory. On a self-hosted runner that is reused between jobs, delete the keychain and the profile at the end, even when the job fails.</p>
<p>Two things that cost people time:</p>
<ul>
<li>The <code>.p12</code> has to contain the <strong>private key</strong>, not just the certificate. In Keychain Access, expand the certificate and select it together with the key underneath before exporting. A <code>.p12</code> without the key imports without complaint and fails later at <code>codesign</code>.</li>
<li>If the build has two profiles that were both downloaded as <code>profile.mobileprovision</code>, one can silently overwrite the other. Give them distinct names.</li>
</ul>
<p><strong>Good for:</strong> small teams, one app, people who want to see exactly what's happening.
<strong>Trade-off:</strong> you rotate the <code>.p12</code> by hand when it expires, and anyone who can read CI secrets can sign as your team.</p>
<h2>Option B: fastlane match</h2>
<p><code>match</code> keeps your certificates and profiles encrypted in a private git repo (or a Google Cloud or S3 bucket) and installs them on each machine. Its documentation recommends running it in <code>readonly</code> mode on CI, so CI can fetch certificates but never create or revoke them. The <code>setup_ci</code> action creates a temporary keychain and switches <code>match</code> to read-only for you.</p>
<p>I haven't run <code>match</code> in our pipeline, so I'll leave the details to its docs. The point that matters here: <strong><code>readonly</code> on CI is exactly the rule this whole post is about.</strong> The machine that gets destroyed is never the one that creates certificates.</p>
<p><strong>Good for:</strong> teams with several developers and several apps.
<strong>Trade-off:</strong> one more tool and one more encrypted store to look after.</p>
<h2>Option C: Apple's cloud signing</h2>
<p>Since Xcode 13, Apple can sign distribution builds with a <strong>cloud-managed certificate</strong>: the private key stays with Apple, not on your machine. In CI this means giving <code>xcodebuild</code> an App Store Connect API key and <code>-allowProvisioningUpdates</code> at <strong>export</strong> time. Nesim Razon describes this setup in a recent DEV post about shipping a Kotlin Multiplatform app from Windows; in that write-up an App Manager key wasn't enough for cloud signing and an Admin key was.</p>
<p>We haven't tested this path ourselves, so two things to check if you use it:</p>
<ul>
<li>Keep <code>archive</code> unsigned (Fix 1). Cloud signing covers distribution, but an automatically signed <code>archive</code> on a fresh machine can still go looking for a development identity, and that's where our stray certificate came from.</li>
<li>An Admin-role key can do a lot more than sign. Weigh that against storing a <code>.p12</code>.</li>
</ul>
<p><strong>Good for:</strong> people with no Mac at all who don't want to handle a <code>.p12</code>.
<strong>Trade-off:</strong> a high-privilege key lives in CI.</p>
<h2>Option D: don't sign in CI</h2>
<p>Build with <code>CODE_SIGNING_ALLOWED=NO</code> and sign on a machine you control. You still get compilation, tests and artifacts from CI, and your signing identity never leaves your laptop. If you have a Mac and ship once a week, this is a perfectly good answer.</p>
<h2>Cleaning up what's already there</h2>
<p>On developer.apple.com, <strong>Certificates</strong>, look at the development certificates named "Created via API" and check the dates against your CI history. Apple's docs say that any provisioning profile containing a revoked certificate becomes invalid, so before revoking, make sure no development profile you still use on your own machine includes it. Revoking stray <em>development</em> certificates doesn't touch apps already on the App Store, which are signed with your distribution certificate.</p>
<h2>The rule we took away</h2>
<p><strong>A machine that is destroyed after the job should never be allowed to create anything in your Apple account.</strong> Credentials go in read-only; nothing comes out. Our check now isn't "did this build pass", it's "did the certificate count stay the same". A build that passes while it leaves something behind in a third-party account is the hardest kind of bug to notice.</p>
<hr />
<p><em>This article was written with the help of AI and checked against our own build logs and the official Apple, GitHub and fastlane documentation.</em></p>
]]></content:encoded></item></channel></rss>