iOS Build (Xcode Setup)

Build iOS applications using Xcode for App Store distribution. This comprehensive guide covers iOS project configuration, signing, and building for both Parent and Student apps on macOS.

Requirements: iOS development requires macOS with Xcode installed and an active Apple Developer account for App Store distribution.

1. Prerequisites and Setup

Ensure your development environment is ready for iOS development:

Required Software

macOS 12.0+

Required for Xcode and iOS development

Xcode 14.0+

Latest version from Mac App Store

Apple Developer Account

Required for App Store distribution ($99/year)

iOS Device

For testing (iOS 12.0+ supported)

Install Xcode Command Line Tools

# Install Xcode command line tools
sudo xcode-select --install

# Verify installation
xcode-select -p

# Accept Xcode license
sudo xcodebuild -license accept

2. Configure iOS Project Settings

Configure iOS-specific settings for both Parent and Student apps:

Open iOS Project in Xcode

# Open Parent App in Xcode
cd parent_app
open ios/Runner.xcworkspace

# For Student App (in another Xcode instance)
cd ../student_app
open ios/Runner.xcworkspace

Configure App Information

1. General Settings
  • Display Name: Mighty School Parent / Mighty School Student
  • Bundle Identifier: com.mightyschool.parent / com.mightyschool.student
  • Version: 1.0.0
  • Build: 1
  • Deployment Target: iOS 12.0
2. Signing & Capabilities
  • Select your Apple Developer Team
  • Enable "Automatically manage signing"
  • Add Push Notifications capability
  • Add Background Modes (Background fetch, Remote notifications)

3. Configure Info.plist

Update iOS app configuration in Info.plist files:

Parent App Info.plist

<!-- parent_app/ios/Runner/Info.plist -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>Mighty School Parent</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>mighty_school_parent</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FLUTTER_BUILD_NAME)</string>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>

    <!-- Permissions -->
    <key>NSCameraUsageDescription</key>
    <string>This app needs camera access to capture photos for profile and documents.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app needs photo library access to select images for profile and documents.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app needs microphone access for voice messages and calls.</string>

    <!-- Network Security -->
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <false/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>your-domain.com</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <false/>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
            </dict>
        </dict>
    </dict>
</dict>
</plist>

4. Configure Firebase for iOS

Set up Firebase configuration for push notifications:

Add GoogleService-Info.plist

  1. Download GoogleService-Info.plist from Firebase Console
  2. Drag the file into Xcode project (Runner folder)
  3. Ensure "Add to target" is checked for Runner
  4. Verify the file appears in Xcode project navigator

Configure Push Notifications

// ios/Runner/AppDelegate.swift
import UIKit
import Flutter
import Firebase
import UserNotifications

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure()

    if #available(iOS 10.0, *) {
      UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
    }

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func application(_ application: UIApplication,
                           didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Messaging.messaging().apnsToken = deviceToken
  }
}

5. Build iOS Applications

Build iOS applications for testing and distribution:

Build for Simulator (Development)

# Build for iOS Simulator
cd parent_app
flutter build ios --simulator

# Run on simulator
flutter run -d "iPhone 14 Pro"

Build for Physical Device (Development)

# Build for connected iOS device
flutter build ios --debug

# Run on connected device
flutter run -d "Your iPhone Name"

Build for Release (App Store)

# Build release version
flutter build ios --release

# Build with specific configuration
flutter build ios --release --flavor production
Note: Release builds require proper code signing with distribution certificates.

6. Code Signing and Certificates

Configure code signing for App Store distribution:

Create App Store Connect App

  1. Login to App Store Connect
  2. Click "My Apps" → "+" → "New App"
  3. Fill in app information:
    • Name: Mighty School Parent / Student
    • Bundle ID: com.mightyschool.parent / student
    • SKU: MIGHTY_PARENT_001 / MIGHTY_STUDENT_001
  4. Select appropriate categories and age rating

Configure Automatic Signing

  1. In Xcode, select Runner target
  2. Go to "Signing & Capabilities" tab
  3. Check "Automatically manage signing"
  4. Select your Apple Developer Team
  5. Xcode will automatically create and manage certificates

Manual Certificate Management (Advanced)

# Create certificates using fastlane (optional)
gem install fastlane

# Initialize fastlane in iOS directory
cd ios
fastlane init

# Create certificates and provisioning profiles
fastlane match appstore

7. Archive and Upload to App Store

Create archives and upload to App Store Connect:

Create Archive in Xcode

  1. In Xcode, select "Any iOS Device" as destination
  2. Go to Product → Archive
  3. Wait for archive process to complete
  4. Organizer window will open automatically

Upload to App Store Connect

  1. In Organizer, select your archive
  2. Click "Distribute App"
  3. Select "App Store Connect"
  4. Choose "Upload" option
  5. Follow the upload wizard
  6. Wait for processing (can take 10-30 minutes)

Command Line Upload (Alternative)

# Build and upload using Flutter
flutter build ipa --release

# Upload using Xcode command line tools
xcrun altool --upload-app --type ios --file build/ios/ipa/*.ipa --username "your-apple-id@email.com" --password "app-specific-password"

8. Build Automation Script

Create scripts to automate the iOS build process:

#!/bin/bash
# build_ios_apps.sh

echo "Building Mighty School iOS Apps..."

# Check if running on macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
    echo "Error: iOS builds require macOS"
    exit 1
fi

# Build Parent App
echo "Building Parent App for iOS..."
cd parent_app
flutter clean
flutter pub get
flutter build ios --release

# Build Student App
echo "Building Student App for iOS..."
cd ../student_app
flutter clean
flutter pub get
flutter build ios --release

echo "iOS builds completed!"
echo "Open Xcode to archive and upload to App Store:"
echo "1. parent_app/ios/Runner.xcworkspace"
echo "2. student_app/ios/Runner.xcworkspace"

Next Steps

Upload to Stores

Submit your apps to App Store and Google Play Store

Upload to Stores →

Desktop Builds

Build Windows and macOS desktop applications

Build Desktop Apps →