购买Mac
PDD 比TB JD 便宜500,下单
![](https://img-blog.csdnimg.cn/img_convert/94b2c8156e656f9c5ca4e478a453be3c.jpeg)
安装homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安装npm cnpm
brew install node;
npm install -g cnpm --registry=https://registry.npm.taobao.org;
安装类似Android的adb
安装 libimobiledevice, ideviceinstaller:
brew install libimobiledevice;
brew install ideviceinstaller;
安装Appium
Requirements
macOS, Linux or Windows operating system
Node.js 14+
NPM (Node Package Manager) 8+
命令行安装
sudo cnpm install -g appium
Gui安装
https://github.com/appium/appium-desktop/releases/latest
安装Appium Inspector
https://github.com/appium/appium-inspector/releases/tag/v2022.11.1
官网下载太慢,所以上传CSDN
安装Xcode
App Store
![](https://img-blog.csdnimg.cn/img_convert/c7c56a20b54944bac88718b668dc636b.png)
Build WDA
下载WDA代码
推荐github desktop 下载代码,简单方便快捷
https://github.com/appium/WebDriverAgent
打开手机的开发者模式,连接Mac
Xcode 打开并且修改 签名数据
这块参考
https://blog.csdn.net/liuage_/article/details/124508920
(1) 设置【WebDriverAgentLib】、【WebDriverAgentRunner】、【IntegrationApp】的Team,选择自己登录的Apple ID,登录Apple ID:(左上角Xcode-》Preferrence-》点击下面的进行增删)
![](https://img-blog.csdnimg.cn/img_convert/28ac010acebce042b0ba437bc147ff95.png)
(2)设置【WebDriverAgentRunner】、【IntegrationApp】Build Settings下Packaging目录下Product Bundle Identifier的id,把其中facebook改掉就行,自己随意改
![](https://img-blog.csdnimg.cn/img_convert/2aa4e94aa6159685498c31418eba944f.png)
(3) 设置【Product】→【Scheme】选择【WebDriverAgentRunner】
![](https://img-blog.csdnimg.cn/img_convert/ed72ff85924fb44f9d9f9ad756b2414f.png)
(4) 选中自己连接的设备,command + u 运行即可
![](https://img-blog.csdnimg.cn/img_convert/8963ba63e2c0d045273e08f383fb8fcc.png)
(5) 第一次运行需要在真机设置里面给证书设置信任【设置】→【通用】→【VPN与设备管理】选择开发者APP下面刚安装的WebDriverAgent信任即可,在次command+u即可正常运行,启动成功后Xcode下面会出一串URL
![](https://img-blog.csdnimg.cn/img_convert/320ce056fd959e11375d2ecd64b3f45b.png)
(6) 然后关闭Xcode服务 ,Xcode也可以关闭了,WebDriverAgent配置完成
![](https://img-blog.csdnimg.cn/img_convert/7389c5ef48b94a82b721620dcebfca5b.png)
使用Inspector查看手机
打开appium Gui
默认设置
打开appium inspector
remote path /wd/hub/
配置
{
"platformName": "ios",//苹果手机默认
"appium:platformVersion": "16.1",//ios版本
"appium:udid": "xxxxx-00113xxx",//idevice_id -l
"appium:deviceName": "SuperXX",//设备名
"appium:automationName": "Appium",//默认
"xcodeSigningId":"iPhone Developer",//默认
"xcodeOrgId":"WS6RPRBF68" //keychain 组织单位
}
![](https://img-blog.csdnimg.cn/img_convert/a8edc5adbedb9e07a7cbcb8600388de9.png)
搞定
10. 问题合集
TBD