Overview
Building for iOS production creates an IPA (iOS App Store Package) file that can be:- Uploaded to TestFlight for beta testing
- Submitted to the App Store for review and distribution
- Distributed via Enterprise or Ad Hoc provisioning
Prerequisites
Building for iOS requires:
- macOS with Xcode installed
- Apple Developer account ($99/year)
- Valid provisioning profiles and certificates
Building with Xcode
Archive for Distribution
Select scheme and device
- In Xcode toolbar, select your scheme
- Select Any iOS Device (arm64) as destination
Create archive
- Go to Product > Archive
- Wait for the build to complete
- Organizer window will open automatically
Building with Command Line
Using xcodebuild
Build for Generic Device
Export IPA
ExportOptions.plist
Createios/ExportOptions.plist:
ios/ExportOptions.plist
app-store- For App Store Connectad-hoc- For specific registered devicesenterprise- For enterprise distributiondevelopment- For development builds
Using Fastlane
Fastlane automates the entire build and distribution process.Install Fastlane
Configure Fastfile
ios/fastlane/Fastfile
Run Fastlane
Build Configurations
Debug vs Release
Debug:- Fast Refresh enabled
- Developer menu available
- Not optimized
- Larger binary size
- Optimized for performance
- Smaller binary size
- No developer tools
- JavaScript bundled in app
Custom Configurations
Create custom configurations in Xcode:Duplicate configuration
- Select project > Info tab
- Under Configurations, click +
- Select Duplicate “Release” Configuration
- Name it (e.g., “Staging”)
Build with Custom Configuration
Code Signing
Automatic Signing
Recommended for most developers:- In Xcode, select your target
- Signing & Capabilities tab
- Check Automatically manage signing
- Select your Team
Manual Signing
For advanced control:- Uncheck Automatically manage signing
- Select Provisioning Profile for each configuration
- Ensure certificates are installed in Keychain
Certificates
You need:- Development Certificate - For debug builds
- Distribution Certificate - For release builds
Provisioning Profiles
- Development - Testing on registered devices
- Ad Hoc - Testing on up to 100 registered devices
- App Store - For App Store distribution
- Enterprise - For in-house distribution (requires Enterprise account)
Version Management
Update Version and Build Number
Via Xcode
- Select target > General tab
- Update Version (e.g., “1.2.0”)
- Update Build number (e.g., “42”)
Via Command Line
Via Fastlane
Version Requirements
- Version (CFBundleShortVersionString): User-facing version (e.g., “1.2.0”)
- Build (CFBundleVersion): Must be unique for each build uploaded to App Store Connect
Upload to App Store Connect
Using Xcode Organizer
- Product > Archive
- In Organizer, select archive
- Click Distribute App
- Choose App Store Connect
- Select Upload
- Follow wizard
Using Transporter App
- Download Transporter
- Open app
- Sign in with Apple ID
- Drag and drop IPA file
- Click Deliver
Using Command Line
Generate app-specific password at appleid.apple.com.
Using Fastlane
Optimization
Reduce App Size
Enable Bitcode (if applicable)
ios/Podfile
App Thinning
App thinning is automatic when distributing via App Store Connect. The App Store delivers optimized versions to each device.Remove Unused Assets
Use asset catalogs and remove unused images.Optimization Settings
In Build Settings:- Optimization Level (Release):
-Osor-O3 - Strip Debug Symbols:
YES - Strip Linked Product:
YES - Make Strings Read-Only:
YES - Dead Code Stripping:
YES
Testing Release Build
Test Locally
Run release build on simulator:TestFlight
Best way to test production builds:- Upload build to App Store Connect
- Build processes automatically
- Add internal/external testers
- Testers install via TestFlight app
Continuous Integration
GitHub Actions
.github/workflows/ios.yml
Using Fastlane in CI
Troubleshooting
Code Signing Issues
Error:No signing certificate found
Solution:
- Ensure you’re logged into Xcode with Apple ID
- Download certificates from Developer Portal
- Install in Keychain Access
Provisioning Profile Errors
Error:No provisioning profile found
Solution:
- Use automatic signing in Xcode
- Or download profile from Developer Portal
- Install by double-clicking
.mobileprovisionfile
Build Failed
Error: Various build errors Solution:Archive Upload Failed
Error:This action could not be completed
Solution:
- Check App Store Connect status
- Verify bundle ID matches your app
- Ensure version/build number is unique
- Try uploading via Transporter app
Missing Compliance
Error: Export compliance warning Solution: Add toInfo.plist:
true and answer compliance questions in App Store Connect.
App Store Guidelines
Required App Information
Required App Information
Before submission, prepare:
- App name and subtitle
- Description
- Keywords
- Support URL
- Privacy policy URL
- Screenshots for all device sizes
- App icon (1024x1024px)
Privacy Requirements
Privacy Requirements
- Declare data collection practices
- Include privacy policy
- Request permissions with usage descriptions
- Implement App Tracking Transparency if needed
Review Guidelines
Review Guidelines
Follow App Store Review Guidelines:
- App must be complete and functional
- No placeholder content
- Accurate metadata
- Proper use of APIs
Next Steps
Run iOS
Build and run on iOS devices
Publishing Guide
Complete guide to App Store submission
iOS Logs
Debug with iOS logs
App Signing
Deep dive into iOS code signing