Complete guide to setting up iOS deployment for your Kotlin Multiplatform project.
- macOS with Xcode installed
- Apple Developer Account ($99/year)
- Enroll at: https://developer.apple.com/programs/
- Git for code signing certificate storage
- Ruby and Bundler for Fastlane
- GitHub CLI (
gh) for easier repository management - Firebase account for app distribution
Run the comprehensive iOS setup wizard:
bash scripts/setup_ios_complete.shThis interactive wizard will guide you through:
- ✅ Team ID configuration
- ✅ App Store Connect API key setup
- ✅ Fastlane Match repository configuration
- ✅ SSH key generation for Match
- ✅ Certificate synchronization
- ✅ TestFlight & App Store review contact information
- Log in to Apple Developer Portal
- Go to Membership section
- Copy your Team ID (10 characters, e.g.,
L432S2FZP5)
This allows Fastlane to upload builds and manage TestFlight/App Store submissions automatically.
- Log in to App Store Connect
- Go to Users and Access → Keys tab
- Click + to generate a new key
- Enter name:
Fastlane Deploy Key - Select role: App Manager or Admin
- Click Generate
- Download the .p8 key file (you can only do this once!)
- Note the Key ID (10 characters)
- Note the Issuer ID (UUID format)
Important: Store the .p8 file securely! You cannot download it again.
Fastlane Match stores your iOS certificates and provisioning profiles in a Git repository, allowing sharing across team members and CI/CD.
Option A: Using GitHub CLI (recommended)
gh repo create ios-certificates --privateOption B: Manually
- Create a new private repository on GitHub/GitLab/Bitbucket
- Name it:
ios-certificatesorios-provisioning-profile - Keep it empty (no README)
# The setup wizard does this automatically, or manually:
ssh-keygen -t ed25519 -C "fastlane-match" -f secrets/match_ci_key -N ""- Go to your Match repository on GitHub
- Settings → Deploy keys
- Click Add deploy key
- Title:
Fastlane Match CI - Paste the public key from
secrets/match_ci_key.pub - ✅ Check Allow write access (Match needs to push certificates)
- Click Add key
Match encrypts your certificates with a password:
# Generate secure password
openssl rand -base64 32 > secrets/.match_passwordImportant: Store this password in your password manager! You'll need it on all machines and in CI/CD.
Now that you have all the prerequisites, run the setup wizard:
bash scripts/setup_ios_complete.shThe wizard will:
- Collect all required information
- Generate
secrets/shared_keys.env - Set up SSH keys for Match
- Initialize Match (sync certificates)
- Validate configuration
This project uses a shared vs app-specific configuration pattern:
Located in fastlane-config/project_config.rb and loaded from secrets/shared_keys.env:
Same for ALL apps:
- Team ID
- App Store Connect API credentials
- Match repository URL
- TestFlight & App Store review contact information
Why shared? When you create multiple apps from this template, they all use the same Apple Developer account and infrastructure.
Located in fastlane-config/project_config.rb:
Changes per app:
- Bundle identifier (e.g.,
com.example.myapp) - Firebase App ID
- App version and build number
- Project paths
Why separate? Each app you create from the template has a unique bundle ID and Firebase configuration.
When you run customizer.sh with a new package name:
- ✅ Updates
IOS[:app_identifier]to your new bundle ID - ✅ Updates Firebase app ID
- ✅ Preserves
IOS_SHAREDcompletely (shared infrastructure) - ✅ Updates Xcode
project.pbxprojwith new bundle ID
After setup, these files will exist (all gitignored):
secrets/
├── shared_keys.env # Shared iOS configuration
├── .match_password # Match encryption password
├── AuthKey.p8 # App Store Connect API key
├── match_ci_key # Match SSH private key
├── match_ci_key.pub # Match SSH public key
└── shared_keys.env.template # Template (can be committed)
If your app uses Firebase Cloud Messaging for push notifications:
bash scripts/setup_apn_key.sh- Go to Apple Developer Keys
- Create new key with Apple Push Notifications service (APNs) enabled
- Download the .p8 key file
- Run the setup script to configure
- Upload to Firebase Console (Cloud Messaging → APNs authentication key)
Verify your setup:
# Verify APN configuration (if applicable)
bash scripts/verify_apn_setup.sh
# Test deployment to Firebase
bash scripts/deploy_firebase.sh
# Check Fastlane configuration
bundle exec fastlane ios --helpSolution:
- Verify deploy key added to Match repository
- Check "Allow write access" is enabled
- Test SSH connection:
ssh -i secrets/match_ci_key -T git@github.com
Solution:
- Verify
secrets/.match_passwordcontains the correct password - If lost, you'll need to revoke certificates and regenerate (contact Apple)
Solution: This is normal on first run if certificates already exist in Match repo. Match will download and use them.
Solution:
# Manually sync certificates
bundle exec fastlane ios sync_certificates match_type:adhoc
bundle exec fastlane ios sync_certificates match_type:appstoreSolution:
Verify Team ID in secrets/shared_keys.env matches your Apple Developer account.
Solution: Fastlane automatically increments build numbers. If there's a conflict, manually increment in Xcode or delete the conflicting build in App Store Connect.
-
✅ Never commit secrets to git
- All secrets are in
.gitignore - Only commit
.templatefiles
- All secrets are in
-
✅ Rotate API keys periodically
- Regenerate App Store Connect API keys every 6-12 months
-
✅ Use strong Match passwords
- Minimum 16 characters
- Store in password manager
-
✅ Limit API key permissions
- Use "App Manager" role instead of "Admin" when possible
-
✅ Store secrets securely
- Use 1Password, LastPass, or similar for team sharing
Once setup is complete:
-
Test Firebase Deployment:
bash scripts/deploy_firebase.sh
-
Test TestFlight Deployment:
bash scripts/deploy_testflight.sh
-
Configure App Store Metadata:
- Add app description, screenshots, etc. in App Store Connect
-
Set up CI/CD:
- Add secrets to GitHub Actions / CI environment
- See
.github/workflows/for CI templates
- Apple Developer Support: https://developer.apple.com/support/
- Fastlane Docs: https://docs.fastlane.tools/
- Match Documentation: https://docs.fastlane.tools/actions/match/
- App Store Connect: https://developer.apple.com/support/app-store-connect/
# Setup
bash scripts/setup_ios_complete.sh # Complete iOS setup
bash scripts/setup_apn_key.sh # Setup push notifications
bash scripts/verify_apn_setup.sh # Verify APN setup
# Deployment
bash scripts/deploy_firebase.sh # Deploy to Firebase
bash scripts/deploy_testflight.sh # Deploy to TestFlight
bash scripts/deploy_appstore.sh # Deploy to App Store
# Certificate Management
bundle exec fastlane ios sync_certificates match_type:adhoc # Sync AdHoc certs
bundle exec fastlane ios sync_certificates match_type:appstore # Sync App Store certs
# Debugging
bundle exec fastlane ios --help # Show all lanes
cat secrets/shared_keys.env # View configuration
ls -la secrets/ # List all secret filesReady to deploy? See IOS_DEPLOYMENT.md for deployment workflows and best practices.