用途:从通过 USB 连接的真实 iOS 设备(非模拟器)截取屏幕截图,底层使用 pymobiledevice3。
安装: uv tool install pymobiledevice3 或 pipx install pymobiledevice3
前提条件:物理 iOS 设备通过 USB 连接;设备已开启开发者模式(设置 > 隐私与安全性 > 开发者模式);设备已信任,已在设备上批准“信任此电脑”提示。
iOS 17+(含 iOS 26+)用法:需以 root 权限运行 tunneld 守护进程。 终端 1:sudo pymobiledevice3 remote tunneld 终端 2:pymobiledevice3 developer dvt screenshot --tunnel "" /path/to/screenshot.png --tunnel "" 表示通过 tunneld 与设备通信。iOS 17+ 通常需用 DVT 变体(developer dvt screenshot),普通 developer screenshot 常失败。
iOS 16 及更早:pymobiledevice3 developer screenshot /path/to/screenshot.png
相关命令:xcrun devicectl list devices 列出设备;ideviceinfo -k ProductVersion 查看 iOS 版本;ideviceimagemounter list 检查开发者镜像;pymobiledevice3 mounter auto-mount --tunnel "" 自动挂载。多设备时需将 UDID 直接传给 --tunnel(而非 --udid),因为 --tunnel "" 会交互选择,在非交互 shell 中会失败。
常见问题:出现 InvalidServiceError 或服务启动失败时,确认 tunneld 在运行(ps aux | grep tunneld),并使用 DVT 命令;出现 DeveloperDiskImage not mounted 时执行自动挂载。
限制:仅适用于物理设备,非模拟器;iOS 17+ 需要 root 运行 tunneld;多设备需指定 UDID。价格、平台支持范围等暂未提供。