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.
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
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.
Open "Terminal" (In spotlight, type 'Terminal' and press enter)
cd ~/Desktop and press Enter
instruments -s devices and press Enter, then choose the simulator device you selected earlier and select the UDID string between the square brackets, right click and copy.
xcrun simctl install [UDID] [App name] , replace the [UDID] with the string you copied just now, replace App name with the file name of the app (with '.app' at behind). It should look similar to this :
xcrun simctl install 18BF1A2D-15C2-40E2-80A6-0CB87D2B56D4 exampleApp.app .
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