IOS使用chrome://inspect 调试页面

2,756 阅读2分钟

一、前期安装

1. 安装 scoop(windows 的包管理工具)

打开windows PowerShell

方式一:直接在开始菜单搜索 windows powershell

方式二:win+R 输入powershell

运行

# 修改执行策略,选择A全是
set-executionpolicy unrestricted -s cu

#安装scoop
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

报错1: 使用“1”个参数调用“DownloadString”时发生异常:未能解析此远程名称.........................””

解决:打开C:\Windows\System32\drivers\etc

复制hosts文件在桌面,编辑hosts文件 ,插入下列内容到结尾处

185.199.108.133 raw.githubusercontent.com

185.199.109.133 raw.githubusercontent.com

185.199.110.133 raw.githubusercontent.com

185.199.111.133 raw.githubusercontent.com

保存移动到C:\Windows\System32\drivers\etc替换hosts文件

Ping raw.githubusercontent.com

测试连接状态

image.png

报错2: 使用“1”个参数调用“DownloadString”时发生异常:“请求被中止: 未能创建 SSL/TLS 安全通道。”

解决:

在PowerShell 窗口运行

[Net.ServicePointManager]::SecurityProtocol

返回的协议不包含 Tls12 ,需要启用更多的服务

在PowerShell 窗口运行,添加服务

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12

再次运行,查看协议

[Net.ServicePointManager]::SecurityProtocol

Tls12 已经添加成功

成功安装信息

2. 安装 ios_webkit_debug_proxy

运行

# 安装 extras
scoop bucket add extras

可能会出现以下错误:

OpenSSL SSL_connect: Connection was reset in connection to github.com:443

解决:

在C:\Windows\System32\drivers\etc添加 github.com的映射ip

140.82.112.3 github.com

如果出现:Couldn’t find manifest for ‘ios-webkit-debug-proxy’.

重新安装extras

# 卸载
scoop bucket rm extras

# 重装
scoop bucket add extras

# 再次安装 ios-webkit-debug-proxy
scoop install ios-webkit-debug-proxy

成功

2. 安装调试依赖包

安装remotedebug-ios-webkit-adapter

# 全局安装vs-libimobile
npm install vs-libimobile -g

# 全局安装remotedebug-ios-webkit-adapter
npm install remotedebug-ios-webkit-adapter -g

二、开启调试

1. 设备配置

启用iOS调试

设置 => Safari 浏览器 => 高级 => web 检查器 => 启用

2. USB连接手机

USB连接手机,如果弹出信任授权,点击信任

未弹出信任授权

方式一:安装爱思助手:url.i4.cn/faIfqyaa

方式二:打开手机设置 => 通用 => 还原=> 还原位置与隐私

3. 启动监听

电脑控制台运行

# 指定端口
remotedebug_ios_webkit_adapter --port=9000

Chrome浏览器打开 chrome://inspect/#devices

点击Configure...

添加localhost:9000 ,对应上remotedebug_ios_webkit_adapter的端口,点击Done

4. 启动网页

点击Safari 浏览器,打开网页

在chrome可以找到对应的网页,点击inspect

二、开启调试