After you create your app, you need to complete couple of chores to release your app. For most of the tasks, fastlane is a good choice. I personally automate screenshots and framing screenshots with fastlane. There is one thing that you can’t automate with fastlane yet, that is recording an app preview. In this short post I will show you how you can create an app preview with simulator which can be uploaded to iTunes Connect after some editing.

It is actually better to use physical device and QuickTime to record your app preview which is the only officially supported method. Since I already created UITest for screenshots, I thought why I don’t use those tests for the script of my App Preview. Xcode 8.2 added a new feature which is recording video of Simulator screen.

You can easily record simulator video by using following code

xcrun simctl io booted recordVideo <filename>.<extension>

We can write UI Test, go to Terminal, write this command and stop it later on. But we can do better.

1. Fixing Status Bar

As you know, when you record with QuickTime, Carrier is removed, 9:41 AM is displayed for the time, the battery is full and shows 100%.

We can easily fake this with Simulator Status Magic. You can either use it as pod, framework or standalone application. I personally like to use it as standalone application. Download Simulator Status Magic and run on the simulator that you want to run your tests on. iPhone 7 Plus or iPhone 8 Plus devices are good for recording videos. Since iTunes connect accepts videos for these device sizes and automatically converts videos to other sizes. Run Simulator Status Magic and tap on “Apply Clean Status Bar Overrides”

Now we fixed status var. Let’s go on recording with video

2. Creating UI test for videos.

In your UItest target, write your test functions. I personally like to write single test function. Otherwise Xcode will run your target each time for each test and you had to repeat some UI logic again.

3. Automating recording

– Create videos folder in your main project folder.

– Edit schema of your project



– Select Test from the left side

– Go to Pre-action and hit + button and select “New Run Script Action” and paste below

xcrun simctl io booted recordVideo $SRCROOT/videos/test.mov & SERVER_PID=$! echo $SERVER_PID > $BUILD_DIR/serverpid.txt

Let me explain what this commands do

First line starts recording video of simulator and by using & it doesn’t wait for that command to exit.

Next line stores pid of that process in a variable. Finally we store pid in serverdpid.txt

– Go to Post-actions section and hit + button and select “New Run Script Action” and paste below

kill -INT `cat $BUILD_DIR/serverpid.txt`

This line sends SIGINT (Ctrl+C) to process which has a process id stored in serverpid.txt

Open your UITest target and hit start on your test functions. You will have your videos stored in your videos folder. Only problem is your recording will start when your simulator starts booting. You need to cut that part out from the beginning.

I attached one simple project so that you can easily see how it works.

Sample Project