以编程方式从连接的 Mac 计算机获取 iOS 设备屏幕截图

发布于 2024-12-02 22:50:56 字数 276 浏览 1 评论 0原文

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

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

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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

じ违心 2024-12-09 22:50:56

是的,有办法。您想要安装免费的 libimobiledevice 库: https://github.com/benvium/libimobiledevice-macosx

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

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

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

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.

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

開玄 2024-12-09 22:50:56

我不知道如何以编程方式从设备上获取屏幕截图并保存到 Mac 上,但您可以在运行应用程序时进入管理器,在列表中选择设备,然后在“屏幕截图”子菜单下单击新的屏幕截图按钮。您甚至不必调试应用程序,这可以随时完成。

在此处输入图像描述

此功能更有用的应用之一是能够捕获启动图像的默认屏幕,或创建 App Store 示例图像所需的图像。

I do not know how to programmatically get the screenshot off of the device and onto your Mac, but you can go into Organizer while you are running your application, select the device in the list, and under the Screenshots sub-menu, click on the New Screenshot button. You do not even have to be debugging the application, this can be done at any time.

enter image description here

One of the more useful applications of this feature is being able to capture a default screen for the launch image, or creating the images needed for the App Store sample images.

血之狂魔 2024-12-09 22:50:56

检查是否有 Xcode for Organizer snapshot 的 Applescript 字典条目。如果是这样,请以编程方式调用或运行此 Applescript 函数。

Check to see if there is a Applescript dictionary entry for Xcode for Organizer snapshot. If so, programmatically call or run this Applescript function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文