libimobiledevice

#### 安装与卸载

```bash
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 # 查看指定设备安装的所有应用
```

#### 列出本机模拟器及连接设备的信息
```bash
instruments -s devices
```

#### 查看连接设备信息
```bash
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
```

#### 备份
```bash
idevicebackup
```

#### 获取系统崩溃日志
```bash
idevicecrashreport
```

#### 远程调试代理
```bash
idevicedebugserverproxy
```

#### 获取设备时间
```bash
idevicedate
```

#### 重启设备
```bash
idevicedignostices restart
```

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

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

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

#### show SDK
```bash
xcodebuild -showsdks # 查看本机sdk版本
```

#### 开启指定模拟器
```bash
xcrun instruments -w 'iPhone 7 Plus (11.4) [$uuid]'
```

#### 安装指定app
```bash
xcrun simctl install booted <app path>
```

#### 运行指定app (com.example.app)
```bash
xcrun simctl launch booted <bundleID>
```

#### 卸载指定应用
```bash
xcrun simctl uninstall booted <bundleID>
```

### appium inspector 这个基本没法用
```bash
app-inspector -u $uuid/udid
```

### appium-desktop inspector 这个最好用了
```
1、打开appium-desktop,start;
2、菜单栏->Appium->new session window;
3、saved capabillity sets中设置参数, host:127.0.0.1:4723/wd/hub,
devices = {
"platformName": "iOS",
"deviceName": "iPhone 6",
"platformVersion": "11.0",
"bundleId": "com.chezhubang",
"automationName": "XCUITest",
"udid": "2aeda56a9b8c38eacb6ff8055ecce4998174cd0f"};
4、start session;
```

### xcodebuild
```bash
UDID=$(idevice_id -l)
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test
```

### wda inspector 这个相对好用一点
```bash
UDID=$(idevice_id -l)
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test
https://[ip]/inspector
```

### iproxy
```bash
iproxy [port] [port]
```

### 查看设备的描述文件
```bash
ideviceprovision list
```

原文地址:https://www.cnblogs.com/medivhxu/p/10939588.html