Capture iOS Simulator video for App Preview
For Xcode 8.2 or later
You can take videos and screenshots of Simulator using the
xcrun simctl
, a command-line utility to control the Simulator
-
Run your app on the simulator
-
Open a terminal
-
Run the command
-
To take a screenshot
xcrun simctl io booted screenshot <filename>.<file extension>
For example:
xcrun simctl io booted screenshot myScreenshot.png
-
To take a video
xcrun simctl io booted recordVideo <filename>.<file extension>
For example:
xcrun simctl io booted recordVideo appVideo.mov
-
-
Press ctrl + C to stop recording the video.
The default location for the created file is the current directory.
Xcode 11.2 and later gives extra options.
From Xcode 11.2 Beta Release Notes
simctl video recording now produces smaller video files, supports HEIC compression, and takes advantage of hardware encoding support where available. In addition, the ability to record video on iOS 13, tvOS 13, and watchOS 6 devices has been restored.
You could use additional flags:
xcrun simctl io --help
Set up a device IO operation.
Usage: simctl io <device> <operation> <arguments>
...
recordVideo [--codec=<codec>] [--display=<display>] [--mask=<policy>] [--force] <file or url>
Records the display to a QuickTime movie at the specified file or url.
--codec Specifies the codec type: "h264" or "hevc". Default is "hevc".
--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"
--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: Not supported, but retained for compatibility; the mask is rendered black.
black: The mask is rendered black.
--force Force the output file to be written to, even if the file already exists.
screenshot [--type=<type>] [--display=<display>] [--mask=<policy>] <file or url>
Saves a screenshot as a PNG to the specified file or url(use "-" for stdout).
--type Can be "png", "tiff", "bmp", "gif", "jpeg". Default is png.
--display iOS: supports "internal" or "external". Default is "internal".
tvOS: supports only "external"
watchOS: supports only "internal"
You may also specify a port by UUID
--mask For non-rectangular displays, handle the mask by policy:
ignored: The mask is ignored and the unmasked framebuffer is saved.
alpha: The mask is used as premultiplied alpha.
black: The mask is rendered black.
Now you can take a screenshot in jpeg
, with mask (for non-rectangular displays) and some other flags:
xcrun simctl io booted screenshot --type=jpeg --mask=black screenshot.jpeg
Using xcrun simctl
:
xcrun simctl io booted screenshot <filename>.<file extension>
Using Screen Capture:
Use cmd + shift + 5
and the resize the selection so that the simulator is recorded.
Using QuickTime Player:
You can use QuickTime Player
to record the screen.
- Open
QuickTime Player
- Select
File
from the menu - Select
New Screen recording
Now from the Screen Recording
window, click on the record button.
It will provide you with an option to record the entire screen or a selected portion of your screen.
You will have to make a selection of your simulator so that only the simulator portion will be recorded.
Apple recommends doing so on an actual device and has a guide on how to do this using QuickTime and iMovie on iOS and OS X: https://developer.apple.com/app-store/app-previews/imovie/Creating-App-Previews-with-iMovie.pdf
Summary:
Capture Screen Recordings with QuickTime Player
- Connect your iOS device to your Mac using a Lightning cable.
- Open QuickTime Player.
- Choose File > New Movie Recording.
- In the window that appears, select your iOS device as the Camera and Microphone input source.
Create an App Preview with iMovie
Import Screen Recordings
Next, you import the screen recording files that you captured with QuickTime Player into iMovie. In iMovie:
- Choose File > Import Media.
- In the window that appears, select the screen recording files.
Create an App Preview Project
To start a new app preview project, choose File > New App Preview. A timeline appears where you can add and arrange clips to create your preview.
You can record a portion of the screen with built-in screenshot utility:
- Press Shift-Command-5 to show a control panel.
- Select .
- Select a portion of the screen you want to record. That would be the iPhone simulator.
- Click to stop recording.
- A thumbnail will appear at the bottom right corner of the screen. You can edit it before saving.
If you want to visualize mouse clicks, after step 1 select Options control and enable Show Mouse Clicks.