我的版本:
mac | 版本13.2 |
ios | 16.4 |
xcode | 14.3 |
需要安装:
- homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
可能出现的问题
解决办法:
按照提示输入git命令即可:
- npm
建议npm和cnpm不要混用,避免出现奇怪的问题。
brew install node
- carthage
brew install carthage
- ios-deploy
npm install -g ios-deploy
- libimobiledevice
brew install --HEAD libimobiledevice
- ideviceinstaller
brew install ideviceinstaller
- xcode
app store搜索下载
- appium
sudo cnpm install -g appium
- appium-doctor
#网上的安装方式,但是我运行会报错
npm install -g appium-doctor
#执行以下命令可以成功安装
sudo npm install -g appium-doctor
- appium server gui
# 下载最新版
https://github.com/appium/appium-desktop/releases
- 配置webdriveragent
# 查看appium所在位置
which appium
我的appium在/opt/homebrew/bin/appium
一般来说../lib/对应的是/usr/local/lib
但是我的是在 /opt/homebrew/lib/node_modules/appium/build/lib/main.js
进入appium给目录赋予权限方便后续操作
cd /opt/homebrew/lib/node_modules/appium
sudo chmod -R 777 node_modules
#进到webdriveragent目录下
cd /opt/homebrew/lib/node_modules/appium/node_modules/appium-webdriveragent
#打开
open ./
双击WebDriverAgent.xcodeproj
WebDriverAgentLib、WebDriverAgentRunner、IntegrationApp 按照下图设置
WebDriverAgentRunner、IntegrationApp 按照下图设置:
双击Product Bundle Identifier后面部分,红框标记部位,将原本的facebook改成任意其他单词 再按回车即可保存
配置好scheme和Destination:
注意:ios需要提前开启开发者模式:
设置-通用-安全与隐私-开发者模式。开启后需要重启才能生效
按command+u键可能出现以下报错:
这是由于WebDriverAgent版本原因导致
然后再按command+u会弹出一下提示:(网图)
去手机的设置-通用-- VPN与设备管理中 会看到开发者app 点击-信任
再次按command+u 会弹出以下弹窗
请输入电脑的锁屏密码,点击始终允许。可能会弹出很多个弹窗目前不知道原因,请耐心多次输入密码关闭所有弹窗。
再次按command+u 会提示build successed。大功告成!!!!
关闭运行:
按xcode页面左上角的方块图标,或者同市长按手机的两个音量键。
无线连接:
手机和电脑需处于同一局域网
window→devices and simulators
勾选connect via network
尝试连接手机:command+u。会出现以下弹窗
回到window→devices and simulators页面,右键点击页面左边的设备列表。点击connect via ip address
讲手机的IP地址填入框中
手机IP地址查看方式:设置→Wi-Fi→已连接网络尾部的ⓘ图标→下翻至ipv4地址处→IP地址
连接成功设备后面会有一个🌐图标