Blog

New features in Xcode 8.2 Simulator

22 Feb, 2017
Xebia Background Header Wave

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.

tumblr inline ncwiwdtX3d1rgy2ig

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 command xcrun simctl io booted screenshot.
    šŸ“¹ To take a video, run the command xcrun 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!

1

1rWk0MfJ24rKg4RaMOjCsCw

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!

1PkDckGqzuJL9kPWw7dcRTg

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 insta
lled 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.
1gTE dBzOjl BCo9K2yLJEw

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!

Follow me on twitter to get updated about new blogs.

Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts