Build iOS App¶
Before we start the build App process, please make sure you have the following settings ready:
- Build environment setup (Node, Ionic, Cocoapods, Xcode)
- App info setup
- App icon and splash
- (Optional) Firebase for push notification
- (Optional) Language setting
Note
It is highly recommended that you build Android and iOS App in seperate project folders.
Preparing an iOS build¶
Steps¶
-
Open your terminal and cd to the project root.
cd hamv_mobile
-
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>" } } }
-
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 usingpod repo update
orpod install --repo-update
.Once updated, remove the previous build files by using[!] 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`.
sh customer/remove.sh
. Then run step 3 again. -
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"
-
Execute the following command.
cd platforms/ios && pod install && cd ../..
-
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
-
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.
-
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.
-
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
-
Go to Resources > Images, make sure the Appicon images of 60pt exist.
-
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¶
-
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
-
Open ".xcworkspace" in Xcode. The file should be under
/platforms/ios/.xcworkspace
-
Connect your phone via USB and select it as the run target, as pictured below.
-
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¶
-
After build success, go back to Xcode project and click Product > Archive
-
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
-
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.
-
Click the tab "App Store", and click "Prepare for Submissions"
-
Upload your build file
Have more questions? Submit a request