Skip to content

Build iOS App

Before we start the build App process, please make sure you have the following settings ready:

Note

It is highly recommended that you build Android and iOS App in seperate project folders.

Preparing an iOS build

Steps

  1. Open your terminal and cd to the project root.

    cd hamv_mobile
    
  2. Create a build.json file in your IDE and put it under the root folder.

    {
        "ios":{
            "debug":{
                "developmentTeam": "<your team ID>"
            },
            "release":{
                "developmentTeam": "<your team ID>"
            }
        }
    }
    
  3. Run the following commands one by one.

    npm i app-engine-3.0.0.tgz
    
    npm i
    
    ionic cordova platform add ios@6.3.0
    
    ionic cordova prepare ios
    

    Update Cocoapods Package

    If you see error message when running ionic cordova platform add ios@6.3.0, please update the Cocoapods package by using pod repo update or pod install --repo-update.

    [!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
    In Podfile:
    FBSDKCoreKit (= 11.1.0)
    None of your spec sources contain a spec satisfying the dependency: `FBSDKCoreKit (= 11.1.0)`.
    You have either:
    * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
    
    Once updated, remove the previous build files by using sh customer/remove.sh. Then run step 3 again.

  4. Change the pod project ios deployment target. Go to platform > ios > Podfile. Add this line to the file:

    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "11.0"
    

  5. Execute the following command.

    cd platforms/ios && pod install && cd ../..
    

  6. Open Xcode and select the file name extensions ".xcworkspace" (/platforms > ios > yourApp.xcworkspace)

    Note

    If this is your first time to open Xcode, please agree to the development license by running this command in the Terminal:

    sudo xcodebuild -license accept
    

  7. Open Xcode Settings

    (1) Login in your developer's Apple ID and select your account and click "Manage Certificates" button.

    (2) Create a new certificate if you don't have one.

    (3) Select Location and make sure the Command Line Tools is Xcode 14.3.1.

  8. Go back to the project, check the following signings are correctly selected, the iOS target is iOS11.0 or above, and the device should be Any iOS Device.

  9. Go to Pods in the side menu and check the following items are with correct signing.

    • FBSDCoreKit-FacebookSDKStrings
    • FirebaseInAppMessaging-InAppMessagingDisplayResources
    • GoogleSignIn-GoogleSignIn
    • gRPC-C++-gRPCCertificates-Cpp

  10. Go to Resources > Images, make sure the Appicon images of 60pt exist.

  11. Run build

    #Build debug version:
    ionic cordova build ios --prod --debug --verbose
    
    #Build release version:
    ionic cordova build ios --prod --release --verbose
    

    Note

    If the build fails, you need to remove all built materials and recover the parameters by following scripts and try again from step 3.

    sh customer/remove.sh
    sh customer/recover_env_script.sh
    

Run App on iOS Devices for Testing

Steps

  1. You should have installed the iOS simulator when setting up enviroment in the previous steps. If not, open your terminal and cd to the project rooot to run this command:

    npm i -g ios-deploy ios-sim
    
  2. Open ".xcworkspace" in Xcode. The file should be under/platforms/ios/.xcworkspace

  3. Connect your phone via USB and select it as the run target, as pictured below.

  4. You can now run your app on your phone by clicking the play button. Make sure your device remains USB connected and unlocked.

Upload Build to App Store

Steps

  1. After build success, go back to Xcode project and click Product > Archive

  2. Select the archived file, and click Distribute App button.

    (1) Select App Store Connect and click Next.

    (2) Check the information and click Next.

    (3) Choos Automatically manage signing and click Next.

    (4) Click the button Done after seeing Upload Successful

  3. Go back to App Store Connect, select Activity tab, check if the build that you uploaded is already there

    Note

    If the status for the build is Processing, please wait for a while.

  4. Click the tab "App Store", and click "Prepare for Submissions"

  5. Upload your build file

Have more questions? Submit a request


Last update: July 11, 2023