以编程方式从连接的Mac计算机获取iOS设备屏幕截图 [英] Programmatically get iOS device screenshot from the connected Mac computer

查看:262
本文介绍了以编程方式从连接的Mac计算机获取iOS设备屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以从iOS应用程序中的代码以编程方式获取屏幕截图,并可以从Xcode和Instruments手动获取屏幕截图(在UIAutomation测试失败时,Instruments也会自动获取屏幕截图).我想找到的是一种编程方式(在Mac上而不是在设备上运行代码)将屏幕快照从设备抓取到插入设备的Mac上.

I know it's possible to get a screenshot programmatically from code in the iOS application, and to manually get screenshots from Xcode and Instruments (Instruments also automatically takes screenshots during UIAutomation test failures). What I would like to find is a programatic way (with code running on the Mac, not the device) to grab screenshots from the device onto the Mac which it is plugged into.

Xcode或Instruments中是否有API(或命令行参数)可以访问此屏幕截图功能?还是(理想情况下)连接到设备并直接获取屏幕截图,就像Xcode和Instruments一样?

Is there an API (or command-line parameters) into Xcode or Instruments to get access to this screenshot feature? Or (ideally) to interface to the device and get a screenshot directly, the same way that Xcode and Instruments do it?

推荐答案

是的,有一种方法.您要安装免费的libimobiledevice库: https://github.com/benvium/libimobiledevice-macosx

Yes, there is a way. You want to install the free libimobiledevice library: https://github.com/benvium/libimobiledevice-macosx

安装后,可以从命令行运行idevicescreenshot,它将带有屏幕截图的TIFF文件保存到当前目录.

When it is installed, you can run idevicescreenshot from the commandline and it will save a TIFF file with a screenshot to the current directory.

请参见 http://pervasivecode.blogspot .de/2012/06/take-iphone-or-ipad-screenshot-from.html

这篇关于以编程方式从连接的Mac计算机获取iOS设备屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆