Making iOS app running on simulator easy
How to Transfer Your App From One Xcode Simulator to Another
Transfer iOS app from one machine to another without running code
Here is how the story began! I was asked by product team to run the app under development on their machines. Not all the members own the physical iOS device which obviously aren’t cheap :D. As a developer I think everyone will agree with me that product teams in the company are always eager to get their hands on the project status in a tangible manner. And when it comes to a mobile app, eagerness is even more as everyone has a smart device in their pocket.
This was an interesting requirement so I set out to explore solutions. Since this would be used by non-developers my goal was to:
- Find a simplest solution which doesn’t involve too much technicality
- Come up with an automated way to minimize the developer time in training and maintaining it.
After spending a lot of time searching on the internet
Here are some options I found:
Solution 1: Simply run the app from Xcode
Even though this option can work but has multiple complexities and dependencies
- Basic understanding of version control — Usually product teams are not used to version control that devs use for code management. For eg, in order to make sure they are up to date they need to make sure they keep pulling the latest code. So there is a learning curve involved here which might not make sense for someone who is not a developer.
- Dependency Changes — Every iOS project uses dependency manager, for eg. pod to manage external libraries. Anytime new dependency is added, a dependency update is needed to be run on the machine itself. Basically our user needs to learn how to build the app from existing code. Again an overkill for the expected outcome.
Solution 2: Accessing the .app file and use it to install on the simulator
I settled on this approach because it is easier for a non-developer to follow and execute.
Here is how I set this up:
1. Find the app file — When you run the app on simulator, it shows all the process on your activity monitor. Filter out the process by searching for your app name. In my case, my test app name is SimulatorApp as you can see in the screen shot below.
Double click on your app process name and you will see another window. On that screen select Open Files and Ports.
2. Copy app file
You will see your app name path in above screenshot, in my case app name is SimulatorApp.app file. Copy that file to your preferred location and then zip it. Now move this zipped file to other computer and unzip the file. And open the simulator on your other machine as shown below.
Please note — In the above screenshot, depending on your version of Xcode, you should see the simulator option if not everything else.
3. Install the app file on simulator
- Unzip the file transferred from other machine
- Drag and drop the file as shown below
If you want to simulate other devices or OS, you can do it very easily as shown below.
Once you switch the simulator, wait for it to start and do the same drag and drop as shown in step 3 above.
Automate the Solution
The above solution works great but this is not automated. Here is what we can do to make it better. We usually have some some sort of CI/CD for our builds. Add a step to build the app for simulator, then access the location Debug-iphonesimulator in your build folder which has .app file. You can upload this file to a shared location say google drive and it can be easily downloaded by any member of product team. By automating this, we can make sure the product team is experiencing current latest progress of your app and can have timely feedback.
Originally published at https://www.shashankthakur.dev.