How to Archive for iOS simulator?
Usually you won't archive iOS app for simulator use, unless... your client suddenly tell you that his iPhone is broken and undergoing repair, but hey he has a Mac that can run Xcode and also iOS simulator and he still want to test your app! Of course you wouldn't want to send the full source code over before client paid you in full. So how do you send him the build to test without sending the source code over?
As per Apple documentation,
Applications built for the simulator cannot be archived
Fortunately, there's a way to send the compiled build so your client can run the compiled build without him having to build from the source code.
Update (October 2018)
honeyeeb mentioned a faster way that we can use the compiled app in the 'Products' folder, send this to colleague/client and ask them to drag and drop it into iOS Simulator.
After building the app, go to the left side navigator bar, select Products > appName.app, right click it and select 'Show in Finder'.
Finder will show the .app file and you can send the file to your colleague / client.
Thanks for the suggestion honeyeeb! đ
1. Locate your iOS Simulator folder in Finder
Open terminal, and run instruments -s devices
, you will see a list of simulator device and their UDID inside square brackets.
I will be using iPhone SE (iOS 11.2) as the selected simulator device for this tutorial, the corresponding UDID for it is "18BF1A2D-15C2-40E2-80A6-0CB87D2B56D4".
The folder containing the simulator data will be located at
~/Library/Developer/CoreSimulator/Devices/[Simulator UDID]
.
In Finder, press Command + Shift + G, and enter the path.
2. Build your app and locate its data folder
Before building your app, I recommend deleting all other existing app you have built previously on the simulator so that you can find your app data folder easier in the next step.
Proceed to build your app as usual in Xcode, my app name is "exampleApp" for this tutorial.
After building, open Finder and proceed to the simulator folder path
~/Library/Developer/CoreSimulator/Devices/[Simulator UDID]
In your simulator folder, locate to data/Containers/Bundle/Application
, here you will see the folder for the apps you have built in the simulator.
To find the folder containing your app, you have to open one by one until you found your app name inside, like this :
Compress the app and send the zip file to your client.
For easier instruction, ask your client to unzip the compressed file at Desktop folder.
3. Instruction for clients
Below are the instruction for clients:
Open Xcode, then start iOS Simulator by choosing Xcode > Open Developer Tool > Simulator.
In Simulator, select the device you want.
Simply drag and drop the app file into the Simulator :
The app should install on the simulator successfully, rejoice!
Send this link to your client for reference if needed : https://fluffy.es/how-to-archive-ios-app-for-simulator/#client