When performing a test using the iOS simulator, an .app file is required.
You will either need to ask your development team to prepare an .app file for you, or generate an .app file from the source code using the steps outlined on this page. (Please note that you cannot generate an .app file from an IPA file, nor can you extract an .app file from an IPA file and run it on a simulator.) You can download the .app file of the MagicPod demo app here.
Table of contents
1. 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])
- Locate the .app file by clicking Product in the menu bar, selecting Show Build Folder in Finder, and navigating to the specified directory ([3]). *If you are unable to find it, check /Users/○○/Library/Developer/Xcode/DerivedData/△△△△/Build/Products/Debug-iphonesimulator.
- Zip the .app file and upload it to MagicPod. ([4])
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 is a wide variety of CI services, but Bitrise has the following features.
- You can start by 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
First, begin with user registration initial setup on Bitrise.
Move to the Bitrise sign-up page and register as a user.
You will receive an email entitled Confirmation instructions from Bitrise, so click 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 see 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 MagicPod 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 your test
Now that you are able to automatically build the app, prepare the .app file that is the simulator app entity file for creating a test using the MagicPod 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 created in Bitrise won't work properly as is on MagicPod due to its directory structure.
3. In the case of Cordova apps
First, following this article, install the test target iOS app to an 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
4. In the case of React Native apps
4-1. If 'No bundle URL present' error shows:
In the procedure of generating an .app file using Xcode, you may encounter the 'No bundle URL
present' error. If this error occurs, please build using the following steps: (See: No bundle URL present [fixed])
1. Duplicate the existing target in Xcode
2. Create a .jsbundle file
Run the following command in the root directory of the React Native project:
$ npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'
If you encounter issues with images not displaying in the built app, execute the following command (Reference):
$ npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --platform='ios' --assets-dest='ios'
3. Include the .jsbundle file in the build
In Xcode, add the main.jsbundle file created in step 2 to BuildPhases > Copy Bundle Resources in the target created in step 1
4. Perform the build
In Xcode, select the target you created in step 1 and build it
4-2. If the app does not start when using a debug build:
Please switch to a release build. It has been identified that the issue occurs when using a debug build, because it attempts to reference the local files on the PC running the simulator. (Reference)
*Notes / Sources
- Handbook for managing bitrise.yml within the repository
- This setting is 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.
- You can set up Webhook later 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. You can delete this.