3.7 KiB
iOS Build and Release Guide - TorqueVaultKMP
This document provides step-by-step instructions to set up the environment and release the iOS application from a Kotlin Multiplatform (KMP) project to the App Store.
1. Environment Setup on macOS
Setup JDK 17
The project requires JDK 17 to run Gradle tasks and build the iOS framework.
-
Check current Java version:
java -versionIf it returns
openjdk version "xx.x.x", you can skip to Install Xcode. -
Install via Homebrew (if not installed):
brew install openjdk@17 -
Configure Environment Variables: Run the following commands to link the JDK and update your
.zshrc:sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc source ~/.zshrc
Setup Xcode
-
Check if Xcode is installed: Ensure you have the latest version of Xcode from the App Store.
-
Check Command Line Tools:
xcode-select -pIf it returns a path, tools are installed. Otherwise, run:
xcode-select --install.
2. Xcode Project Configuration
-
Open the Project: Open
/iosApp/iosApp.xcodeprojin Xcode. -
Setup Signing & Capabilities:
- Select the iosApp project in the Project Navigator.
- Go to the Signing & Capabilities tab.
- Select your Team (Apple Developer Account).
- Verify the Bundle Identifier (must match the ID registered in App Store Connect, e.g.,
com.digitoolsolutions.app.torquevaultkmp).
-
Update Version and Build:
- In the General tab, update:
- Version: e.g.,
1.0.2(Should matchversionNameincomposeApp/build.gradle.kts). - Build: e.g.,
2(Should matchversionCodeincomposeApp/build.gradle.ktsand must be incremented for each upload).
- Version: e.g.,
- In the General tab, update:
3. Build and Upload Process
Step 1: Clean Project
Before building the release version, perform a clean directly in Xcode to avoid cache issues:
- Go to Product -> Clean Build Folder (or press
Shift + Command + K). - Note: This will also trigger a clean for the Kotlin framework if configured in the build script.
Step 2: Create Archive in Xcode
- In Xcode, select the build target as Any iOS Device (arm64) from the toolbar.
- Go to Product -> Archive.
- Xcode will start building. The Kotlin framework (
ComposeApp) will be automatically compiled via the Gradle build phase script.
Step 3: Upload to App Store Connect
- Once the Archive is complete, the Organizer window will appear.
- Select the latest build and click Distribute App.
- Choose App Store Connect and then Upload.
- Follow the prompts (Validate, Re-sign).
- Wait for the success notification.
4. App Store Connect Management
- Log in to App Store Connect.
- Select your app TorqueVault.
- Check the build status in the TestFlight tab to ensure it has finished processing.
- When ready, go back to the App Store tab, select the build, and click Submit for Review.
Important Notes
- Framework Name: The main framework is named
ComposeApp. If you changebaseNameinbuild.gradle.kts, you must update the Xcode configuration accordingly. - Permissions: Ensure all required permissions (Bluetooth, Camera, etc.) are declared in
Info.plist. - Dependencies: If the project uses native libraries via CocoaPods or Swift Package Manager, ensure they are correctly installed before building.