Follow me on twitter to get updated about new blogs.
In the release notes of Xcode 8.2, Apple introduced features for their new version of Xcode. In this blog I will explain how to use these new features.
This are the two new features for the Xcode 8.2 Simulator:
- You can take videos and screenshots of Simulator using the
xcrun
Xcode command-line utility.
š· To take a screenshot, run the commandxcrun simctl io booted screenshot
.
š¹ To take a video, run the commandxcrun simctl io booted recordVideo <filename>.<mp4|mov>
(9887264) - Dragging an app onto a Simulator window installs the app. (23387069)
Capture
The first feature, recording videos and taking screenshots, is pretty straightforward. You can start your Simulator, run your app on it and you can take a screenshot or start/stop a video.
This feature is pretty convenient for sending demo videos from your app.
Although the command is pretty long, it works very easy!
Drag andĀ Drop
The second feature, dragging an app onto a Simulator window, was not so straightforward. At least, not for me š
What I thought was that when I have an app inĀ .ipa format, I could simply drag this app onto a Simulator window which will install the app. Too bad, this is not the case.
But what would Apple mean with; āDragging an app onto an SimulatorāĀĀ ? So, I searched the big interwebs and did a bit of research on Twitter, where I received this tweet from Brandon.
Twitter Status By BrandonXamarin
After he gave me this information, I tried to drag an Simulator app bundle (.app) onto a iOS 10.2 Simulator and with success, the app was installed!
The question that raised was; why is aĀ .app working in the Simulator and aĀ .ipa isnāt? This is because an iOS app inĀ .ipa format is build for a different architecture(ARM) then where the Simulator works on(x86).
So, an iOS app inĀ .ipa format can only be installed on a physical device and will never work on a Simulator!
Additional: Get the app bundle from DerivedData
Now we know how to drag and drop the app bundle onto the Simulator, I would also like to give some details about the app bundle.
The app bundle is located in the DerivedData folder and is compiled when the project is build for a device. This DerivedData folder contains all the intermediate build information, debug- and release-build targets, as well as your projectās index.
The specific location of the Simulator app bundle can be found here:
~/Library/Developer/Xcode/DerivedData/<project name>/Build/Products/Debug-iphonesimulator/
From Xcode you can go to the DerivedData folder via File Ć¢āā Workspace Settings. This will popup the following window.
Clicking on the arrow will open a Finder window with the DerivedData folder. Next, go to the <project name>/Build/Products/Debug-iphonesimulator/ folder. In this folder you will find the app bundle. Finally, drag the app bundle onto the iOS Simulator and the app will be installed!
Additional 2 (Feb. 2017): Get the app bundle fromĀ Products
After sharing this knowledge with my colleagues at Xebia, one colleague told me another way of getting the app bundle.
In a Xcode project, default there will also be a folder called āProductsāĀ. When a project is successfully build, the app bundle will also be linked in this folder. From this folder, you can drag theĀ .app bundle to the simulator.
This way does not involve the cumbersome way of navigating to the DirevedData folder! So less steps are needed and you can be more productive.
Enjoy and thanks for reading!