Xcode 8.2 模拟器在调试时崩溃并退出保存屏幕截图

Xcode 8.2 simulator crash and quits on saving a screenshot while debugging

我将 Xcode 更新到 8.2,从那时起,如果我在调试时尝试截取屏幕截图,它就会崩溃然后退出。

我试过 iOS 9.0 和 10.0 模拟器,它们都发生了这种情况。'

谢谢

Update:

8.2.1 - Doesn't works

8.3 - Works only with Mac OS Sierra

请尝试这种截屏方法

You can take videos and screenshots of Simulator using the xcrun Xcode command-line utility. To take a screenshot, run the command xcrun simctl io booted screenshot. To take a video, run the command xcrun simctl io booted recordVideo <filename>.<file extension>. (9887264)

来源:Xcode 8.2 Release Notes

Simulator can crash when saving a screenshot when running on OS X El Capitan. (29182710) The crash does not occur on macOS Sierra.

是的,不幸的是,这是在 OS X 10.11 上被 Foundation 中的一个错误绊倒了。如果你升级到 macOS Sierra.

就不会有问题了

如果您现在无法升级到 Sierra,您仍然可以从命令行截取屏幕截图:

xcrun simctl io booted screenshot <path to output file>

这个在Xcode 8.2 Release Notes

中有提到

Simulator can crash when saving a screenshot when running on OS X El Capitan. (29182710) The crash does not occur on macOS Sierra.

有一个非常简单的解决方法。

  1. 在模拟器菜单中进入编辑->复制屏幕
  2. 然后打开"Preview"并按cmd+n(从剪贴板新建)
  3. 导出 - 为其命名并欣赏您可爱的屏幕截图。

对于静态屏幕截图,更简单快捷的解决方法是键入 COMMAND+SHIFT+4,然后点击 space 栏直到选择模拟器 window,然后单击模拟器 window保存截图。