iOS Simulator 录视频截图

本文介绍了如何通过命令行工具`xcrun simctl`来控制iOS模拟器进行截图和录制视频。你可以使用`xcrunsimctl iobooted screenshot`命令保存截图到指定路径,如`~/Desktop/screenshot.png`。同时,利用`xcrunsimctl iobooted recordVideo`命令开始录制视频,视频将保存为`~/Desktop/simulator.mov`。录制完成后,可以使用`ffmpeg`转换工具将视频转换为GIF格式。这为开发者提供了一种快速、便捷的远程操作iOS模拟器的方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

开发感兴趣的小伙伴可关注个人 github

how to control the Simulator with command line ?

see the built-in help to check what simctl can do

xcrun simctl

take a screenshot or record a video from a simulator using the following command line
xcrun simctl io <device> <operation> <arguments>

  • take a screenshot
xcrun simctl io booted screenshot ~/Desktop/screenshot.png
  • start to record a video
xcrun simctl io booted recordVideo ~/Desktop/simulator.mov
  • end recording
control + c

Convert the iPhone 6s screen shot into a gif:

ffmpeg -i ~/Desktop/simulator.mov -vf scale=320:-1 -r 6 -f gif -y ~/Desktop/simulator.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值