23

I know that it's possible to record the screen on Yosemite and take screenshots that have 9:41 am. Is this same functionality possible with the Simulator?

4 Answers 4

24

Starting with Xcode 11 beta 4, you can use the xcrun simctl command to set the time and battery in the Simulator.

xcrun simctl status_bar <device> override --time "9:41" \
    --batteryState charged --batteryLevel 100

Example of usage:

xcrun simctl status_bar "iPhone 11 Pro Max" override --time "9:41" \
    --batteryState charged --batteryLevel 100

The simulator needs to be run before executing the command.

See https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_4_release_notes for more details.

There is a tool to loop across all running simulators and also handle time zones a bit better than explicitly calling it each time: 2020-09-15T09:41:00-07:00

7
  • 5
    Use booted instead of <device> to apply the settings to all running simulators.
    – testing
    Aug 26, 2020 at 9:54
  • 1
    You can also set the date (which is displayed on iPads) by passing a time string with full ISO date format, e.g.: "2021-06-28T07:32:00-07:00" May 13, 2021 at 22:00
  • 2
    @RobinStewart Or go with 2020-09-15T09:41:00-07:00 if you want to match Apple's current iPad product images. It seems like they just take the first Tuesday in the last September that has a two-digit day ordinal.
    – YourMJK
    May 16, 2021 at 23:24
  • 1
    There's Nine41 that helps to avoid a lot of typing.
    – Ivan Mir
    Jun 3, 2021 at 4:16
  • 1
    I tried this, but it didn't work. Do I just type this in the terminal app? Dec 11, 2022 at 12:50
7

There are 2 ways to do this:

1. Clone, build and run SimulatorStatusMagic in your simulator.

This will only work for your simulator.

https://github.com/shinydevelopment/SimulatorStatusMagic

cd ~/Desktop
git clone [email protected]:shinydevelopment/SimulatorStatusMagic.git
cd ~/Desktop/SimulatorStatusMagic
open SimulatorStatusMagic.xcodeproj/
# Build the "Framework" Target
# Build & RUN the "SimulatorStatusMagic" in your Emulator

2. via QuickTime Player:

This will only work for your device.

  • Connect your own device to your Mac.
  • Open "QuickTime Player" (Install if required)
  • File → New Movie Recording
  • Click the dropdown next to the Red Record button
  • Select your iPhone e.g: "Anil's iPhone"
  • Record and bring your screen up, then Stop the recording.
  • Now you can "Play" your recording, find the screen you want, pause it,
    Edit Menu → Copy (will copy the screen grab).

Both should result in something like this (Time 9:41 AM - Full Battery and Wifi):

How to take a 9 41 AM iPhone Screenshot

2
  • This tool is useful if you have iOS 12 or lower and/or Xcode 10 or lower.
    – testing
    Aug 26, 2020 at 15:15
  • Thank you, it works pretty well!
    – imike
    May 19 at 22:23
0

I simply run this command in the terminal after running my code on the simulator:

xcrun simctl status_bar booted override --time "2007-01-09T09:41:00-6:00" --wifiBars 3 --cellularBars 4 --batteryLevel 100

You will need to replace the timezone -6:00 to whatever yours is.

1
  • 1
    How does that command differ from the one in the question - ie what exact part of the command line does the OP need to chnage? and preferably explain why
    – mmmmmm
    Apr 12, 2022 at 18:07
-1

Now that Apple has delivered a tool to manage this, use Nine41 and/or xcrun simctl status_bar

Those are far more time efficient than fixing it in post production with Photoshop or Pixelmator or Acorn and your video editor of choice as you are in to pay attention to these details.

One screen shot at the right time with light and dark backgrounds let you adjust the battery level, bars, time and more to suit your needs.

There are even plug in to the simulator that will programmatically clean up the status bar for more than just time if you are running your code that way and not on a device:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .