How to Change Directory where iOS Simulator Saves

2020-05-24 04:14发布

问题:

When saving a screenshot from the iOS Simulator, the screenshots are saved to the Desktop

After taking a few, my Desktop is quickly polluted with screen shots that don't belong there.

How does one change the directory where iOS Simulator screenshots are saved?

In some issue related to where screenshot gets stored, a commenter responded that 'by default' they get stored on the desktop (implying it could be changed).

(iOS Simulator 8.0, Xcode 6.0.1, Mac OS X 10.9.5)

回答1:

Following on from: https://stackoverflow.com/a/44810443/14868

As of Xcode 9, you can also set the output folder using the defaults command and integrate it with any machine setup you use.

Example:

defaults write com.apple.iphonesimulator ScreenShotSaveLocation "$HOME/Screen Shots"



回答2:

EDIT: iOS Simulator custom screenshot directory support added in Xcode 9 beta

The iOS Simulator does not currently have an option to change the default screenshot directory.

Please duplicate my bug report! http://bugreport.apple.com

rdar://26127809
Allow iOS Simulator to specify a non-Desktop directory for CMD-S screenshots.

In the mean time, I use the app Hazel to automatically move iOS Simulator screenshots (taken via ⌘S) from the default Desktop location to my Simulator Screenshots folder.

Hazel watches whatever folders you tell it to, automatically organizing your files according to the rules you create.

http://www.noodlesoft.com/hazel.php



回答3:

Xcode 9 adds behavior for setting a custom directory for iOS Simulator screenshots.

Press ⌥⌘S or Hold the ⌥ Option key and select the menu item:

File > New Screen Shot...

This presents a file "Save As..." dialog. Note the new checkbox on the dialog:

Use this as the default location

Check that checkbox to change the default directory for ⌘S iOS Simulator screenshots.



回答4:

You will not be able to do that.

An easy alternative could be:

  1. press cmd+shft+4
  2. press spacebar
  3. Click your iPad/iPhone simulator window

with changing the default screenshot directory: Change the Screen Shot Save File Location in Mac OS X