Take screenshots in the iOS simulator - ios

I want to take a screenshot of my iOS application when it is running in the simulator, and save the screenshot on my Mac. How can I do this?

It's just as simple as command+s or File > Save Screen Shot in iOS Simulator. It will appear on your desktop by default.

An update with Xcode 11.4 simulator
To capture a screen shot, click on 'Camera' icon/action button, on the top bar of simulator.
OR
Select Save Screen Shot menu item, from File menu.
File => Save Screen Shot
Use ⌘ + S to capture a screen shot.
(Use window + s, if you are using windows/non-apple keyboard).
See for more details: How to change simulator scale options with Xcode 9+.
Tip 1: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?
Disable Optimize Rendering for Window scale from Debug menu, before you take a screen shot.
Here is an option
Menubar ▶ Debug ▶ Disable "Optimize Rendering for Window scale"
Tip 2: Where is screen shot saved (Default Path)? How to change default path?
Simulator saves screen shot file on (logged-in user's) desktop and it's default path.
To change default path (with Xcode 9+), press and hold ⌥ Option (alt) button from keyboard, while you take a screen shot. Or
Using Mac Keyboad: Press keys ⌥ Option + ⌘ + s all together.
It will show to a dialog with file storage options and also allows to set/change default path.
Tip 3: How to take a screen shot with Device Bezel?
Enable Show Device Bezel from Window menu.
Here is an option
Menubar ▶ Window ▶ Enable "Show Device Bezel"
Now,
Press ⌘ + shift + 4 + Spacebar, all together in Mac Keyboard. (A window snap capture mode will become active)
Select Simulator window/frame, that you want to capture. It will save screenshot with device bezel (with shadow effect in background) on (logged-in user's) desktop.
You can also remove the Simulator toolbar as described here.

on iOS Simulator,
Press Command + control + c or from menu : Edit>Copy Screen
open "Preview" app, Press Command + n or from menu : File> New from clipboard
, then you can save command+s
For Retina, activate iOS Simulator then on menu:HardWare>Device>iPhone (Retina)
and follow above process
Command + S
is the way to save on Desktop, (on new iPhone simulators, this was introduced in later simulator)

Press Command+Shift+4 and then keep the mouse pointer on Simulator and then press "Space Bar" key one camera icon will appear, now left click the mouse. Your simulator screen shot is saved on desktop. You can take the screen shot any small screen in the same way.

You can google for IOS Simulator Cropper software useful for capturing screen shots and also easy to use with various options of taking snapshots like with simulator/without simulator.
Update
Just pressing CMD + S will give you screenshot saved on desktop. Pretty easy huh..

Since Xcode 8.2, you can also save a screenshot with the following command:
xcrun simctl io booted screenshot
Further information in this blog: https://medium.com/#hollanderbart/new-features-in-xcode-8-2-simulator-fc64a4014a5f#.bzuaf5gp0

Focus simulator
Go to menu File->Save Screen Shot
or
Press ⌘+S
Screen shot saves in desktop

Simple answer with sample answer ;-)
on iOS Simulator,
Press Command + control + c or from menu : Edit>Copy Screen
open "Preview" app, Press Command + n or from menu : File> New from clipboard , then you can save Command + s
UnCheck Alpha
You can change Image dimension to your requirement.
Here is the Final Image,For example

For some reason the commands posted before dont work for me, but this one does:
xcrun simctl io booted screenshot screenshot.png
Running Xcode 9.2

First, run the app on simulator.
Then, use command+s, or File -> Save Screenshot in Simulator to take necessary and appropriate shots.
The screenshots will appear on your desktop by default.

2020 Latest Update: XCode 11.4
Click on the camera icon above simulator to capture screenshot and save to your camera roll
Another option:
File > Save Screen from simulator

For people using Xcode 11.4, to get rid of the simulator top bar, this is far from ideal but you can disable shadows for the screenshot application in a terminal with the following command :
$ defaults write com.apple.screencapture disable-shadow -bool TRUE; killall SystemUIServer
Then, you can use ⌘ + ⇧ + 4 and select the simulator to take a screenshot. Without the shadow, you can easily crop the top bar with the preview app. To re-enable the shadow for the screenshot application :
$ defaults write com.apple.screencapture disable-shadow -bool FALSE; killall SystemUIServer
Source of this answer here.

In OSX Captain its a bug to take screenshot of simulator. You have to Update your OSX Sierra first then your are able to take. while taking in OSX Captain use terminal command which is xcrun simctl io booted screenshot.
before running this command u have to select desktop in terminal like:
"cd desktop" then run that command. Happy Coding!!!

Screenshot with device frame
Step - 1
Open quick time player
Step - 2
Tap new screen recording
Step - 3
Select Capture selected window
Step - 4
Cursor point on the simulator. It will automatically select the whole simulator like
Step - 5
Screenshot will open using preview. save it.
Here is some sample screenshot

Click CMD+SHIFT+4.
Put mouse over Simulator.
Press SPACE to select whole Window.
Press ALT+Enter to capture simulator window with no shadow.
Remove top bar from screenshot in GIMP or double click on screenshot preview to edit.
I found no way to hide top window bar and screenshot nice phone image with shadow. Apple rox ;-)

Press ⌘S or go to File > Save screenshot from your simulator menu and you will get the screenshot saved on your desktop.

First method:
Select simulator and press "command + s" button. Screenshot saved on desktop.
Second method:
Select simulator and go to "File > New Screenshot". Screenshot saved on desktop.

In case using XCUITests automation :
XCUIApplication().buttons["Add"].screenshot()
XCUIApplication().table["names"].screenshot()
API details : https://developer.apple.com/documentation/xctest/xcuiscreenshot

If you want to attach the device frame to your screenshot, use
xcrun simctl io booted screenshot shot.png && curl -F 'file=#shot.png' "https://shot.withfra.me/new"
It uploads the screenshot to a third party (WithFrame) that adds the device frame.
More info can be found here

Taking Screen Shot in IOS Simulator is SO Simple.
When you Open Simulator In the Right Lift You See File.
Click On File And You See Option Save Screen Shot.
This Option Saves Your Screen Shot In Default Path Which is Desktop.

Related

Actual size disable in XCode 9 iPhone simulator scale [duplicate]

On the 24" iMac I'm using at work I cannot scale the iOS Simulator's window. The 100% and 50% menu entries are greyed out (and the keyboard shortcuts don't work either.)
On my Mac Mini at home, it's fine. I've searched high and low for someone with a similar problem, and can't find anything logged. Any ideas?
Now It's more flexible with Xcode 9+ Simulator. You can pick & drag any corner of simulator to resize it and set it according to your requirement.
Look at this snapshot.
Note: With Xcode 9.1+, Simulator scale options are changed.
There are several other ways also, to scale your simulator.
Keyboard short-keys:
According to Xcode 9.1+
Physical Size ⌘ 1 command + 1
Pixel Accurate ⌘ 2 command + 2
According to Xcode 9
50% Scale ⌘ 1 command + 1
100% Scale ⌘ 2 command + 2
200% Scale ⌘ 3 command + 3
Simulator scale options Menu:
Xcode 9.1+:
Menubar ▶ Window ▶ "Here, options available to change simulator scale" (Physical Size & Pixel Accurate)
Pixel Accurate: Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled.
Xcode 9.0:
Menubar ▶ Window ▶ Scale ▶ "Here, options available to change simulator scale"
Using Terminal Command
Follow these steps to scale simulator using terminal commands
Close/Quit simulator. (if open)
Open Terminal app (using Spotlight search, Press ⌘ + SPACE to open spotlight search)
Copy following text and paste it next to terminal cursor.
defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"
Open 'Simulator' (Run your iOS project using Xcode).
You will find simulator scale update.
The options will only be there if your screen is not large enough to show the window at 100%.
For Xcode 9, we detect the size of your screen. If it isn't large enough to display the window we disable the relevant scaling option.
As Krunal points out you can now drag to scale the window to whatever arbitrary size you want so this shouldn't be a problem. (In previous releases you could only pick from pre-defined sizes; the window itself was not resizable).
I solved this problem by changing the resolution of my Macbook Pro screen to biggest supported value, And increase the size of the simulator by drag and it's work!
I can now attach iPad screenshot. Thanks Apple it's totally easy like always!.
I can confirm that #Abdulaziz Noor method of changing the resolution of your mac display works.
Steps I took:
System Preferences -> Displays -> Display -> Scaled -> More Space
If you are just wanting a 100% screen shot you can just drag it to be anything at least as big as 100% and the screenshot will be the same as a 100% screenshot.
Even in xcode9 it won't let you set the scaling to 100% if your screen can't accommodate that, but you can cheat.. ..just choose landscape orientation and if the width of the device will fit the height of the screen, you can choose 100%, and then rotate the device even if it won't all fit on screen.

How to quit or close single simulator from opened multiple simulator in Xcode 9?

I run multiple simulator and I need to close one of them. How can i do this? Because I tried to close it like we does in older version of Xcode but can't close.
Select Simulator.. Go into File Menu -> Close window or press [Command + W ]. It will close the simulator which is on top .
Go into Windows menu -> uncheck Show Device Bezels. Then you can close using red cross icon on simulator.
There are two ways to close particular Simulator form Multiple simulators
Long-press power button on the right-top of simulator , then slide to turn off power, a single simulator will be close.
Go into File Menu -> Close window or press [Command + W ]. It will close the simulator which is on top
1) Simple way to close single simulator
-> Select required Simulator
-> Click Command + W (⌘W).
2) If you want to minimise simulator
-> Select required simulator
-> Click Command + M (⌘M).
3) For screen shot of simulator
--> Select required simulator
-->Select Commend + S (⌘S).
4) If you want to rotate simulator(for landscape mode)
-> Select required simulator
-> Click Command + left arrow or right arrow.
See below screen for left arrow or right arrow
To long-press power button on the right-top of simulator , then slide to turn off power, a single simulator will be close.
I found a way, but it was by a program I used called HyperDock. It gives a preview of the app windows that are opened when you hover over the icon in the dock. It will give you an option to close the simulator window when you see the preview.
Click Simulator. Open simulator dropdown from the top menu. Click on quit simulator

iOS: Not showing launch view

I added the launch images in the target settings as shown in this picture:
When I click the little eye icons, the correct image shows.
The images are in the project root.
But, they don't display when I try it in the simulator or on the device.
tri to cancel and reinstall the app on the simulator

Reduce the Xcode Simulator (Retina 4 inch)

I'm using macbook Air and using the iphone Simulator. I changed it to Retina 4 inch, and the screen of the simulator become so big! is there a way to reduce the size?
You can scale it with the following shortcuts:
⌘+1: 100%
⌘+2: 75%
⌘+3: 50%
⌘+4: 33%
⌘+5: 25%
Or in iOS Simulator: Window > Scale > ...
The iOS Simulator's Window menu has an option to display the simulator at 50%, 75%, or 100%. Try one of the smaller values to make it fit.
Now It's more flexible with Xcode 9-Simulator.
You can pick & drag any corner or simulator to resize it and set it according to your requirement.
There are several other ways also, to scale your simulator.
Using Terminal Command
Follow these steps to scale simulator using terminal commands
Close/Quit simulator. (if open)
Open Terminal app (using Spotlight search, Press ⌘ + SPACE to open spotlight search)
Copy following text and paste it next to terminal cursor.
defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"
Open 'Simulator' (Run your iOS project using Xcode).
You will find simulator scale update.
Simulator scale options from Xcode Menu:
Menubar >> Window >> Scale >> "Here available options for simulator scaling"
Here is ref snapshot:

How to resize the iPhone/iPad Simulator?

The iPad-simulator is really small (like one third the size of the real iPad screen) on my 23" Full-HD screen (and also on the 15" MacBook Pro).
Is there a way to resize it?
I know it must maintain size and dpi-ratio to prevent sub-pixels, but I can hardly see anything withoout a magnifier.
⌘+1 for 100%
⌘+2 for 75%
⌘+3 for 50%
It's more flexible with Xcode 9-Simulator.Just pick & drag any corner of simulator to resize it and set it according to your requirement.
Look at this snapshot:
Note: With Xcode 9.1+, Simulator scale options are changed.
Keyboard short-keys:
According to Xcode 9.1+
Physical Size ⌘ 1 command + 1
Pixel Accurate ⌘ 2 command + 2
According to Xcode 9
50% Scale ⌘ 1 command + 1
100% Scale ⌘ 2 command + 2
200% Scale ⌘ 3 command + 3
Simulator scale options from Xcode Menu:
Xcode 9.1+:
Menubar ▶ Window ▶ "Here, options available change simulator scale" (Physical Size & Pixel Accurate)
Pixel Accurate: Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled.
Xcode 9.0
Menubar ▶ Window ▶ Scale ▶ "Here, options available change simulator scale"
Using Terminal Command
Follow these steps to scale simulator using terminal commands
Close/Quit simulator. (if open)
Open Terminal app (using Spotlight search, Press ⌘ + SPACE to open spotlight search)
Copy following text and paste it next to terminal cursor.
defaults write ~/Library/Preferences/com.apple.iphonesimulator SimulatorWindowLastScale "0.3"
Open 'Simulator' (Run your iOS project using Xcode).
You will find simulator scale update.
Xcode 9.x :
Select Simulator
Goto Window tab
Select Physical Size option (cmd + 1)
Now if this dosen’t make size as per your interest then follow below steps :
Select Simulator
Goto edge of simulator. This will convert your cursor to resize option (Bidirectional arrow).
Now using this resize option you can change the size as you desire.
Xcode 8 or below :
https://stackoverflow.com/a/30588057/1753005
For Xcode 9, Beta 6: Deselect "Show Device Bezels" under Window menu. Then Cmd + 2 should scale to 100% (Window Menu -> Scale -> 100%).
Tested using 15" Macbook Pro (2017 Model).
For XCode 10 I ended up having to do
defaults delete ~/Library/Preferences/com.apple.iphonesimulator DevicePreferences
I just could not find any other way to reset zoom level. Even using Window->Zoom to toggle zoom, would not restore back to 100% (2042x2732 iPad 12.9-inch).
Deleting device preferences allowed the simulator to open at full resolution again, so I could take the screen shots required for app store submission.
The Physical Size and Pixel Accurate options remain greyed out.
You can do this:
Window > Uncheck Show Device Bezels
After that, you can customize your simulator's width and length.
If you're satisfied in its size, you can check again the 'Show Device Bezels'
Currently, the old scale system (100%, 75%, etc.) is removed, but under Window tab there are four options:
Physical Size
Point Accurate
Pixel Accurate
Fit Screen
Which can be toggled with:
⌘+1
⌘+2
⌘+3
⌘+4
As seen below:
But in the smaller screens(MacBook Pro 15-Inch), I can't scale it more than the screen size
There are little utilities that allows you to set your display resolution much higher as the System Preference may offer you.
For instance, if u need 12.9-Inch Retina Display screenshot with a resolution of 2048 x 2732 pixels for portrait. I simply use one of these utilities (e.g.: Display Menu from the App Store) to set my Macbook Pro 2017 Retina display to 3360x2100.
After that I start the Xcode Simulator with a 12,9" iPad Retina and resize the Simulator to the maximum of the screen. As a result, I get exactly 2048 x 2732 which is ready to upload to the App Store.
Hope that is useful for someone.
Xcode 9.x
You can resize any simulator in the same way of expanding any windows in Mac. Move the mouse over the corner of any simulators and the pointer changes. Click and drag to expand/shrink the simulator. Verified using Xcode 9.2
For Xcode 9.4 this is the only thing which worked:
-Uncheck "Optimize rendering for window size" in the "Debug" menu.
-take a *screen shot using "⌘s" or "New screen shot" from the file maenu.
*note - it doesn't matter what size the simulator is, the screen shot will be the correct size for uploading to iTunes Connect
CMD + Space
Search for System Preferences
Then Select Accessibility
Choose Zoom
Check Use scroll gesture with modifier keys to zoom:
Select CMD Key or Option (whichever you prefer)
Thats it:
Now on your trackpad do
CMD + 2 finger UP and Down to Scroll to Zoom in or Zoom out
Look at this picture.
See the red tips.
You can resize your ios simulator easy.

Resources