IOS自动化常用命令

idevice command

安装与卸载

ideviceinstaller -i xxx.ipa     # 安装
ideviceinstaller -u [bundleID]  # 卸载
ideviceinstaller -u [udid] -l             # 查看指定设备安装的第三方应用
ideviceinstaller -u [udid] -l -o list_system    # 查看指定设备安装的系统应用
ideviceinstaller -u [udid] -l -o list_all       # 查看指定设备安装的所有应用

列出本机模拟器及连接设备的信息

instruments -s devices

查看连接设备信息

idevice_id -l       # 打印当前已连接设备的udid
ideviceinfo         # 打印设备信息
ideviceinfo -k ProductVersion   # 获取连接设备的系统版本号
ideviceinfo -u [udid]                       # 指定设备,获取设备信息
ideviceinfo -u [udid] -k DeviceName         # 指定设备,获取设备名称:iPhone6s
idevicename -u [udid]                       # 指定设备,获取设备名称:iPhone6s
ideviceinfo -u [udid] -k ProductVersion     # 指定设备,获取设备版本:10.3.1
ideviceinfo -u [udid] -k ProductType        # 指定设备,获取设备类型:iPhone8,1
ideviceinfo -u [udid] -k ProductName        # 指定设备,获取设备系统名称:iPhone OS

获取设备时间

idevicedate

重启设备

idevicedignostices restart

截屏

idevicescreenshot /Users/medivh/Desktop/a.png  # 将文件输入到指定路径

日志

idevicesyslog       # 日志输出到屏幕
idevicesyslog -u [udid] > /Users/home/Desktop/log.log       # 将日志输出到指定路径

bundleID

unzip xxx.ipa
cd Payload/xxx.app
defaults read `pwd`/Info CFBundleIdentifier

show SDK

xcodebuild -showsdks  # 查看本机sdk版本

开启指定模拟器

xcrun instruments -w 'iPhone 7 Plus (11.4) [$uuid]'

安装指定app

xcrun simctl install booted <app path>

运行指定app (com.example.app)

xcrun simctl launch booted <bundleID>

卸载指定应用

xcrun simctl uninstall booted <bundleID>

inspector

app-inspector -u uuid/udid
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章