When performing a test using the iOS simulator, the actual app file is required.
When performing tests with each user app, either have the app file prepared by the app development representative, or generate and acquire the app from the app source code using any of steps 1 to 3 below (You cannot generate an app file from an IPA file. You cannot extract the app file from the IPA file, and run it on a simulator. ). It is possible, however, to download the App file of the Demo app provided by MagicPod.
Table of Contents
1. When using Xcode
- Open the app project in Xcode (a Mac is required).
- Change the build target to the appropriate iOS simulator. ([1])
- Run the build. ([2])
- When the build succeeds, an App file shall be generated under the Products folder. ([3])
- When you right-click the file and select "Show in Finder," you can open the location of the App file ([4]). Then zip the app file and upload it to MagicPod. *If you are unable to find it, check /Users/○○/Library/Developer/Xcode/DerivedData/△△△△/Build/Products/Debug-iphonesimulator.
How to generate and acquire an app file
2. When using Bitrise
2-1. Bitrise Initial Setup
Bitrise is a CI service that enables you to build recent popular iOS and Android apps on the Cloud. There are a variety of CI services these days, but Bitrise has the following features.
- You can start using the free version
- It specializes in mobile app builds
- You can easily configure the build with the GUI shown below
The content of the workflow settings are stored in a file called bitrise.yml, which can be edited directly or managed on the Git repository. *1
We will start the explanation with new registration.
- Although this page discusses the procedure for iOS, it is virtually the same for Android. For the detailed Android configuration method, see CI and automated tests on Android apps with Bitrise and Magic Pod
First, let us newly register with Bitrise and perform the initial setup.
Move to the Bitrise sign-up page and register as a user.
You will receive an email entitled “Confirmation instructions” from Bitrise, so click on “Confirm My Account”.
Enter your name, etc.
User registration is complete. Move to the Start Page and click “Add new app.”
After that, you will be in the app build setup screen, so you can configure the build from here
The required settings are as described below.
- CHOOSE ACCOUNT:
- Specifies whether the Bitrise settings are made available to the public. You should set this to Private.
- Connect your repository:
- Specify the Git repository in which the source code for the iOS app you wish to build is contained. You can choose from GitHub/Bitbucket/GitLab. If you do not have the ideal app on hand, you can fork and use the Magic Pod demo app project on GitHub.
- Setup repository access:
- If you need to access an additional, separate private Git repository, such as when using GitHub's submodule feature, configure the necessary settings with "I need to". If nothing in particular comes to mind, select “No, auto-add SSH key.”
- Choose Branch
- Specify the Git branch name to build, such as “master”.
Once you have completed the setup to this point, Bitrise will analyze the contents of the repository, and automatically create the build settings.
Here, you may see the following error message.
If you just want to perform a Magic Pod test with an iOS simulator for now, choose “Proceed anyway” to progress forward.
If you are considering a build on a real device in the near future, you should edit it properly. Following this article, set the build Scheme on Xcode to Shared, and commit the xcshareddata to the Git repository. Then, return to the Bitrise build settings, choose the “Scan another branch” item (leave the branch name as is) and resume the build settings.
Next, you will be asked to “Select ipa export method” as follows, but as these are not relevant in the case of Magic Pod Cloud tests, you can choose “ad-hoc.” *2
If you want to set the app icon, click “Choose Image and Proceed” here.
After doing the final Webhook setup, every time a change (Push or Pull request) occurs to the Git repository, a build occurs automatically. We definitely recommend choosing “Register a Webhook for me!” *3
This completes the initial setup. Finally, when you press the button in the image below, the build will start automatically.
However, it is likely that the first build will fail as shown below.
2-2. Build the iOS app for simulator with Bitrise
The first build failed because the settings required for the iOS real device build were insufficient*4. However, the step introduced this time is the build settings for the iOS simulator, so delete the settings for the real device and swap them with the settings for the simulator.
First, press the “Edit workflow” button on the build results screen to move to the build workflow edit screen.
Here, select “Xcode Archive & Export for iOS” on the left,
and press “Delete Step:Xcode Archive & Export for iOS” to delete the step.
Next, click the “+” button immediately above “Deploy to Bitrise.io - Apps, Lo...”.
and search for and add the “Xcode build for simulator” step*5.
Once you have completed up to this point, save the changes using the save button at the top-right of the screen,
and click the app name at the top of the screen to move to the build screen.
Run the build again from the “Rebuild” button on the failed build results.
The build should succeed this time.
2-3. Prepare the app file required for creating the test
Now that you are able to automatically build the app, next prepare the app file that is the simulator app entity file for creating a test using the Magic Pod Cloud device.
After doing a simple configuration, you can download the app file built with Bitrise.
First, click the “Workflow” tab to move to the Workflow Editor screen visited just now.
Select the “Deploy to Bitrise.io - Apps, Lo...” step,
and set “$BITRISE_APP_DIR_PATH” to “Deploy directory or file path” and “Compress the artifacts into one file?” to true,
and save.
Run the build again.
After the build, click the build results “Artifacts” tab,
and download the created “magic_pod_demo_app.app.zip.”
After downloading the zip file, unzip it once and then zip it again, because the zip file built on Bitrise won't work properly as is on MagicPod, due to its directory structure.
3. In case of the Cordova app
First, follow the procedure here, and install the tested iOS app on the iOS simulator with the “cordova emulate ios” command.
Once the installation is complete, start the app with the iOS simulator.
Next, open the Mac terminal and run the “ps aux | grep app name”. The app name is the same as the normal Cordova project name and partial matches are also possible.
Once the following results are found, the path to the app file should be included there, so zip the app file in the path and upload it to MagicPod.
UICatalog.app path
*Notes / Sources
- Handbook for managing bitrise.yml within the repository
- This setting is the setting for building the ipa file for the iOS real device, and as we are using the iOS simulator for the Magic Pod Cloud test, we shall not build an ipa file.
- When setting up Webhook later, this can be done from the build settings “Code” tab.
- When you check the build Log, you may see the error message “No profiles for ‘***’ were found.”
- In other words, in the steps for “Do anything with Script step” and “Certificate and profile installer”, the iOS simulator build is not required on this occasion. It is just in the way, so you can delete this.