Merge pull request #257 from floatingstarZ/hzy_1220

完善IOS配置文档
This commit is contained in:
yongbin-buaa
2025-12-22 13:01:48 +08:00
committed by GitHub
9 changed files with 137 additions and 44 deletions

View File

@@ -105,52 +105,11 @@ ADB 调试能力,可通过 WiFi 或网络连接设备,实现灵活的远程
## iPhone 环境准备
### 1. Python 环境
如果你使用的是 iPhone 设备,请参考专门的 iOS 配置文档:
建议使用 Python 3.10 及以上版本。
📱 [iOS 环境配置指南](docs/ios_setup/ios_setup.md)
### 2. 设置 WebDriverAgent
WebDriverAgent 是 iOS 自动化的核心组件,需要在 iOS 设备上运行。
注意需要提前安装好Xcode、并注册好苹果开发者账号不需要付费
#### 1. 克隆 WebDriverAgent
```bash
git clone https://github.com/appium/WebDriverAgent.git
cd WebDriverAgent
```
在 Xcode 中打开WebDriverAgent.xcodeproj
#### 2. 设置 Signing & Capabilities
![设置签名](resources/setup-xcode-wda.png)
把Bundle ID改成 YOUR_NAME.WebDriverAgentRunner。
#### 3. 开始UI测试
需要在Finder勾选过“在WiFi中显示这台iPhone”且Mac与iPhone处于同一WiFi网络之下可以不用连接数据线即可在设备中选择到。
**注意:** 不建议插数据线运行因为插数据线还必须要同时运行iproxy才可以把端口映射出来不及直接WiFi运行稳定。
先从项目Target选择WebDriverAgentRunner然后再选择你的设备。
![选择设备](resources/select-your-iphone-device.png)
选好后,长按"▶️"运行按钮选择“Test”后开始编译并部署到你的iPhone上。
![信任设备](resources/start-wda-testing.png)
这时需要你在iPhone上输入解锁密码在设置 -> 通用 -> VPN与设备管理 中信任开发者App还需要在 设置 -> 开发者 中打开UI自动化设置。
![信任设备](resources/trust-dev-app.jpg)
![启用UI自动化](resources/enable-ui-automation.jpg)
该文档详细介绍了如何配置 WebDriverAgent 和 iPhone 设备,以便在 iOS 上使用 AutoGLM。
## 部署准备工作

134
docs/ios_setup/ios_setup.md Normal file
View File

@@ -0,0 +1,134 @@
# iOS 环境配置指南
本文档介绍如何为 Open-AutoGLM 配置 iOS 设备环境。
## 环境要求
- macOS 操作系统
- Xcode最新版本在App store中下载
- 苹果开发者账号(免费账号即可,无需付费)
- iOS 设备iPhone/iPad
- USB 数据线或同一 WiFi 网络
## WebDriverAgent 配置
WebDriverAgent 是 iOS 自动化的核心组件,需要在 iOS 设备上运行。
### 1. 克隆 WebDriverAgent
```bash
git clone https://github.com/appium/WebDriverAgent.git
cd WebDriverAgent
```
直接点击`WebDriverAgent.xcodeproj`即可使用Xcode打开。
### 2. 设置 Signing & Capabilities
1. 在 Xcode 中选中 `WebDriverAgent`出现General、Signing&Capabilities等选项。
2. 进入 `Signing & Capabilities` 选项卡
3. 勾选 `Automatically manage signing`。在Team中选择自己的开发者账号
4. 将 Bundle ID 改为唯一标识符,例如:`com.yourname.WebDriverAgentRunner`
![设置签名1](resources/ios0_WebDriverAgent0.png)
5. TARGETS中建议将WebDriverAgentLib、WebDriverAgentRunner、IntegrationApp的`Signing & Capabilities` 都按照相同方式设置。
![设置签名1](resources/ios0_WebDriverAgent1.png)
### 3. 测试XCode的GUI模式和UI自动化设置
建议先测试GUI模式能否成功安装WebDriverAgent再进行后续步骤。
Mac和iPhone有USB和WiFi两种连接方式建议通过USB方式成功率更高。
#### 通过 WiFi 连接
需要满足以下条件:
1. 通过USB连接。在Finder中选中连接的IPhone在“通用”中勾选"在 WiFi 中显示这台 iPhone"
2. Mac 与 iPhone 处于同一 WiFi 网络之下
#### 具体步骤
1. 从项目 Target 选择 `WebDriverAgentRunner`
2. 选择你的设备
![选择设备](resources/select-your-iphone-device.png)
3. 长按"▶️"运行按钮,选择 "Test" 后开始编译并部署到你的 iPhone 上
![开始测试](resources/start-wda-testing.png)
部署成功的标志1. XCode没有报错。2. 你可以在iPhone上找到名为WebDriverAgentRunner的App
#### 设备信任配置
首次运行时,需要在 iPhone 上完成以下设置,然后重新编译和部署:
1. **输入解锁密码**
2. **信任开发者应用**
- 进入:设置 → 通用 → VPN与设备管理
- 在“开发者 App”中选择对应开发者
- 点击信任“XXX”
![信任设备](resources/trust-dev-app.jpg)
3. **启用 UI 自动化**
- 进入:设置 → 开发者
- 打开 UI 自动化设置
![启用UI自动化](resources/enable-ui-automation.jpg)
### 4. XCode命令行模式部署
1.安装libimobiledevice用于与 iPhone / iPad 建立连接与通信。
```
brew install libimobiledevice
# 设备检查
idevice_id -ln
```
2.使用xcodebuild安装WebAgent。命令行也需要进行“设备信任配置”参考GUI模式下的方法。
```
cd WebDriverAgent
xcodebuild -project WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
-destination 'platform=iOS,name=YOUR_PHONE_NAME' \
test
```
这里YOUR_PHONE_NAME可以在xcode的GUI中看到。
WebDriverAgent 成功运行后,会在 Xcode 控制台输出类似以下信息:
```
ServerURLHere->http://[设备IP]:8100<-ServerURLHere
```
同时观察到手机上安装好了WebDriverAgentRunner屏幕显示Automation Running字样。
其中,**http://[设备IP]:8100**为WiFi所需的WDA_URL。
## 使用 AutoGLM
以上配置完成后先打开一个新终端在后台建立端口映射使用WiFi连接则不需要
```bash
iproxy 8100 8100
```
之后打开一个新终端通过以下命令使用AutoGLMWiFi则使用上述获得的WDA_URL
```bash
python ios.py --base-url "YOUR_BASE_URL" \
--model "autoglm-phone" \
--api-key "YOUR_API_KEY" \
--wda-url http://localhost:8100 \
"TASK"
```
## 参考资源
- [WebDriverAgent 官方仓库](https://github.com/appium/WebDriverAgent)
- [PR141](https://github.com/zai-org/Open-AutoGLM/pull/141)
- [Gekowa提供的ios方案](https://github.com/gekowa/Open-AutoGLM/tree/ios-support)
---
如有其他问题,请参考主项目 README 或提交 Issue。

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB