Impulse AI Docs
Intern dokumentasjon
skipLink.label

iOS bygg og deployment

Denne guiden dekker hele iOS bygg-flyten fra lokal utvikling til TestFlight. Skrevet basert pa feilene vi fant og fikset under forste vellykkede TestFlight-upload (mars 2026).

Hurtigreferanse

heading.anchorLabel
OppgaveKommando
Kjor i simulator⌘R i Xcode
Kjor pa device (USB)Velg device i Xcode → ⌘R
TestFlight-uploaddoppler run -p im -c prd -- fastlane ios beta force:true
Bump versjonfastlane ios bump type:patch
Promoter til App Storefastlane ios promote
Sjekk toolchainfastlane ios doctor

Miljoer — automatisk basert pa byggtype

heading.anchorLabel

Ingen manuell konfigurasjon nodvendig. Appen velger miljo automatisk:

Hvordan du kjorerMiljoAPI
Simulator (⌘R)Developmentlocalhost:3001
USB-device fra XcodeStagingapi-stg.impulseai.app
TestFlightStagingapi-stg.impulseai.app
App StoreProductionapi.impulseai.app

Deteksjon skjer i ImpulseApp.swift ved oppstart:

  • Debug + simulator → Development
  • Debug + device → Staging
  • Release + sandboxReceipt → Staging (TestFlight)
  • Release + ikke sandbox → Production (App Store)

Lokal utvikling (simulator)

heading.anchorLabel

Forutsetninger

heading.anchorLabel
Terminal window
# 1. Start lokale tjenester
pnpm docker:start # Supabase + Redis
# 2. Start API-server (i egen terminal)
doppler run -p im -c dev -- pnpm --filter api dev
  1. Apne iosApp.xcodeproj i Xcode
  2. Velg simulator (iPhone 17 e.l.)
  3. ⌘R — appen kobler til localhost:3001

KMP-endringer

heading.anchorLabel

Nar du endrer Kotlin-kode i shared/:

Terminal window
# Rask kompileringssjekk (13s)
cd apps/mobile-kmp && ./gradlew :shared:compileKotlinIosSimulatorArm64

Xcode embed-scriptet rebuilder automatisk nar .kt/.xml filer endres. Forste build etter Kotlin-endringer tar litt lengre tid.

Swift-only endringer

heading.anchorLabel

Ingen ekstra steg — Xcode inkrementell build er tilstrekkelig. Med InjectionIII kan du fa hot reload.


Device-testing (USB fra Xcode)

heading.anchorLabel
  1. Koble iPhone til Mac med USB
  2. Velg din device i Xcode target-velgeren
  3. ⌘R — appen kobler til Staging API automatisk

TestFlight-upload

heading.anchorLabel

Forutsetninger

heading.anchorLabel
  • Doppler CLI installert og innlogget (doppler login)
  • Ruby + Bundler (bundle install i iosApp/)
  • Xcode CLI tools (xcode-select --install)

Bygg og last opp

heading.anchorLabel
Terminal window
cd apps/mobile-kmp/iosApp
doppler run -p im -c prd -- bundle exec fastlane ios beta force:true

Dette gjor:

  1. Match: Henter signing certificates fra im-certificates repo
  2. Auto-inkrement: Bumper build-nummer fra TestFlight
  3. KMP: Bygger release framework (arm64)
  4. Archive: Bygger Release-IPA med riktig signing
  5. Upload: Laster opp til App Store Connect
  6. Commit: Committer versjonsbump + tagger

Tar ca. 10 minutter. Etter upload tar Apple 5-30 minutter pa processing.

  1. Sjekk status i App Store Connect → TestFlight
  2. Nar status er “Complete” → opprett testgruppe og legg til testere via e-post
  3. Testere far invitasjon pa e-post → apner TestFlight-appen → installerer

TestFlight-testing

heading.anchorLabel

Testere logger inn med Sign in with Apple (vanlig Apple ID). Alt fungerer som i produksjon, med disse forskjellene:

AspektTestFlight (Sandbox)App Store
BetalingGratis — ingen belastningEkte penger
Abonnement-varighetAkselerert (1 mnd = 5 min)Normal tid
FornyelseAuto-fornyer 6 ganger, stopperFornyer til bruker kansellerer
DataLagres i staging SupabaseLagres i production Supabase

Sandbox tidsakselerasjon for subscriptions:

Ekte varighetSandbox
1 uke3 minutter
1 maned5 minutter
1 ar1 time

App Store Connect webhooks

heading.anchorLabel

For at subscription-syncing fungerer med TestFlight, ma webhooks vare konfigurert:

  1. App Store Connect → din app → App Information
  2. Scroll til App Store Server Notifications
  3. Sett begge URL-er:
FeltURL
Production Server URLhttps://api.impulseai.app/webhooks/appstore
Sandbox Server URLhttps://api-stg.impulseai.app/webhooks/appstore

Bumpe versjon (for releases)

heading.anchorLabel
Terminal window
# Patch: 1.0.0 → 1.0.1
bundle exec fastlane ios bump type:patch
# Minor: 1.0.0 → 1.1.0
bundle exec fastlane ios bump type:minor
# Major: 1.0.0 → 2.0.0
bundle exec fastlane ios bump type:major

Build-nummer inkrementeres automatisk av fastlane ios beta.


Signing — hvordan det fungerer

heading.anchorLabel

Match (certificate management)

heading.anchorLabel

Certificates og provisioning profiles lagres i et privat GitHub-repo (DigiteersHQ/im-certificates). Fastlane Match henter og installerer disse automatisk.

HemmelighetKildeBruk
MATCH_GIT_URLDoppler prdGit-repo for certificates
MATCH_PASSWORDDoppler prdDekrypteringsnokkel for repo
ASC_KEY_IDDoppler prdApp Store Connect API
ASC_ISSUER_IDDoppler prdApp Store Connect API
ASC_PRIVATE_KEYDoppler prdApp Store Connect API (.p8)

Alle secrets injiseres via doppler run -p im -c prd --.

Debug vs Release signing

heading.anchorLabel
KonfigurasjonSigningSatt av
Debug (simulator/device)Apple Development (automatic)Xcode
Release (archive)Apple DistributionMatch via Fastlane

CODE_SIGN_IDENTITY i project.pbxproj er "Apple Development" for begge configs. Match overstyrer til Distribution under archive.


Kritiske build-innstillinger

heading.anchorLabel

Disse innstillingene i project.pbxproj matte fikses for at TestFlight-upload skulle fungere:

InnstillingFeil verdiRiktig verdiHvorfor
SDKROOTautoiphoneosauto kan inkludere ugyldige plattformer
ITSAppUsesNonExemptEncryption(manglende)NOApple venter pa export compliance-svar
FRAMEWORK_SEARCH_PATHSHardkodede simulator-stier$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)Sikrer riktig framework per config
App-ikonRGBA (med alfa)RGB (uten alfa)Apple avviser transparente ikoner

KMP Framework-embedding

heading.anchorLabel

Xcode PBXGroup peker hardkodet til iosSimulatorArm64/debugFramework/. For Release device-builds (TestFlight/App Store) kopierer embed-scriptet arm64 release-framework dit:

if CONFIGURATION=Release && not simulator:
cp arm64/releaseFramework → simulatorArm64/debugFramework

Dette er en pragmatisk losning. Xcode Embed Frameworks build phase bruker PBXGroup-stien uansett.


Privacy og App Store-krav

heading.anchorLabel
KravStatusFil
App-ikon 1024x1024 RGBAssets.xcassets/AppIcon.appiconset/
Privacy ManifestPrivacyInfo.xcprivacy
Speech Recognition API-deklarasjonPrivacyInfo.xcprivacy
Export compliance (kryptering)ITSAppUsesNonExemptEncryption = NO
Associated DomainsiosApp.entitlementsimpulseai.app

Nodvendig for App Store (ikke TestFlight)

heading.anchorLabel
KravStatus
Privacy Policy pa impulseai.app/privacyTrenger Sentry + TelemetryDeck tillegg
AASA-fil pa impulseai.app/.well-known/Spesifikasjon levert til landing-team
Paid Apps Agreement i App Store ConnectSjekkes manuelt

”Invalid Bundle — invalid platform in CFBundleSupportedPlatforms”

heading.anchorLabel

shared.framework ble bygget for simulator (iPhoneSimulator) i stedet for device (iPhoneOS). Verifiser:

Terminal window
# Sjekk arkivet
ARCHIVE=$(ls -td ~/Library/Developer/Xcode/Archives/**/*.xcarchive | head -1)
for fw in "$ARCHIVE/Products/Applications/iosApp.app/Frameworks/"*.framework; do
name=$(basename "$fw")
plutil -p "$fw/Info.plist" | grep -A2 CFBundleSupportedPlatforms
done

Fiks: Slett embed-marker og bygg pa nytt:

Terminal window
rm -f shared/build/.last_embed_marker

“Conflicting provisioning settings”

heading.anchorLabel

CODE_SIGN_IDENTITY i Release er satt til noe annet enn "Apple Development". Match overstyrer under archive — project.pbxproj skal alltid ha "Apple Development".

Build henger i “Processing” i App Store Connect

heading.anchorLabel

Vanligvis 5-30 minutter. Hvis det tar over en time, sjekk e-post fra Apple for feilmeldinger. Last opp ny build — den gamle kan ignoreres.

Fastlane “Git repository is dirty”

heading.anchorLabel

Bruk force:true:

Terminal window
doppler run -p im -c prd -- bundle exec fastlane ios beta force:true

KMP-endringer vises ikke i Xcode

heading.anchorLabel

Slett embed-marker:

Terminal window
rm -f apps/mobile-kmp/shared/build/.last_embed_marker

FilRolle
iosApp/fastlane/FastfileAlle Fastlane-lanes (beta, promote, bump, doctor)
iosApp/fastlane/MatchfileMatch-konfigurasjon (cert-repo)
iosApp/fastlane/.env.defaultIkke-sensitive Fastlane-defaults
iosApp/iosApp.xcodeproj/project.pbxprojBuild-innstillinger, signing, framework-stier
iosApp/iosApp.entitlementsApp-capabilities (SIWA, Associated Domains)
iosApp/PrivacyInfo.xcprivacyPrivacy Manifest
iosApp/ImpulseApp.swiftMiljodeteksjon, versjonsjekk, app-oppstart
shared/.../config/Environment.ktAPI-URL-er, nokler, AppConfig