iOS远程真机之ios-minicap安装使用完全指南

ios-minicap简介

       minicap 是开源项目 STF 中的高速截图工具。STF利用此工具不断的传输图片信息并在web端绘制实现 

       以前只有Android版本,最近有新的ios版本,现在就安装过程中遇到的一些问题进行分享(ps:感谢sorccu 在issue里面给我的指点)

       github地址:https://github.com/openstf/ios-minicap

       你可以git clone或者直接下载zip包。

安装教程

       1、准备工作

$ brew install libjpeg-turbo

$ brew install cmake
 
 
  • 1
  • 2
  • 3

       2、下载ios-minicap

$ git clone https://github.com/openstf/ios-minicap
 
 
  • 1

       3、build项目

$ cd /User/yourname/ios-minicap

$ ./build.sh

$ ./run.sh
 
 
  • 1
  • 2
  • 3
  • 4
  • 5

       运行成功后,不要关闭该终端窗口

       4、运行demo

       重新打开一个终端端口

$ cd /User/yourname/ios-minicapexample

$ npm install

$ node app.js
 
 
  • 1
  • 2
  • 3
  • 4
  • 5

       全部成功运行后

       5、打开浏览器,输入网址http://localhost:9002

Q&A:

       在README.MD中请注意下面的安装需求:

这里写图片描述

       我最开始没能注意这个要求,就直接./build.sh 当然是各种报错

       首先安装 libjpeg-turbo

       安装方式:brew install libjpeg-turbo

       然后./build.sh是报这个错误

./open_xcode.sh: line 5: cmake: command not found
make: *** No targets specified and no makefile found. Stop.
 
 
  • 1
  • 2

       然后我就去点击那个cmake的链接。。。最坑的来了,官网下载的都是APP文件,而.build.sh 里面内容如下:

#!/usr/bin/env bash

mkdir build
cd build
cmake ../
make
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

       因为安装的cmake是APP,根本无法从脚本直接启动CMakeLists.txt,我就去issue里面提问题,才发现原来可以通过brew直接安装。。。

       安装方法:brew install cmake

       安装完成之后,再次运行./build.sh,cmake会自动编译配置文件,然后运行./run.sh

$ ./run.sh 

++ system_profiler SPUSBDataType
++ sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'

UDID=0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab
PORT=12345
RESOLUTION=400x600
./build/ios_minicap --udid 0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab --port 12345 --resolution 400x600
EnableDALDevices
2017-07-31 12:24:26.081 ios_minicap[80709:3237274] Available devices:
2017-07-31 12:24:26.081 ios_minicap[80709:3237274] 0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab
2017-07-31 12:24:26.081 ios_minicap[80709:3237274] CC24414NH0XF9T9C7
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

       由于个人隐私原因,将udid部分进行加密(就是用x去替代一部分而已啦)

       我以为这个已经是启用成功

       重新开启一个终端:

       一步一步运行一下代码:

$ cd example

$ npm install

$ node app.js
 
 
  • 1
  • 2
  • 3
  • 4
  • 5

       运行到最后一步开始报错:

Listening on port 9002
Got a client
{ Error: connect ECONNREFUSED 127.0.0.1:12345
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1136:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 12345 }
Be sure to run ios-minicap on port 12345
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

       最开始我也不知道怎么回事,后面才发现,或许是其他终端处理干净,12345端口未被启动或者被占用。

       (ps:如果address: '127.0.0.1',一栏中提示的不是127.0.0.1本地地址,那有同学更改了host然后导致报错,将host改回即可)

       解决方案:

       kill掉所有的进程(或者强制退出终端)

       再次在ios-minicap的目录下/run.sh 启动12345端口号:

       启动信息如下

++ sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'
++ system_profiler SPUSBDataType
+ UDID=0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab 
+ PORT=12345
+ RESOLUTION=400x600
+ ./build/ios_minicap --udid 0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab --port 12345 --resolution 400x600
EnableDALDevices
2017-07-31 14:43:46.851 ios_minicap[82104:3332798] Available devices:
2017-07-31 14:43:46.851 ios_minicap[82104:3332798] 0c6cxxxxxxxxxxe76dfdc55b57e0d1502ab92aab 
2017-07-31 14:43:46.851 ios_minicap[82104:3332798] CC24414NH0XF9T9C7
resolution: 400x600
Allocating 731648 bytes for JPEG encoder
== Banner ==
version: 1
size: 24
pid: 82104
real width: 400
real height: 600
desired width: 400
desired height: 600
orientation: 
quirks: 1
banner: 118b840109010058200901005820001
New client connection
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

       重开一个终端窗口,定位到ios-minicap里面的example文件夹(就是cd到里面那个文件夹中)运行node app.js

       提示:

Listening on port 9002
Got a client
 
 
  • 1
  • 2

       在浏览器中打开http://localhost:9002

       即可实时录制屏幕

这里写图片描述

       希望我的指南能帮助你们成功安装ios-minicap。

ios-minicap 终极大招

       最后,放上终极大招——我正在使用的,已经编译好的项目文件:

       ios-minicap:链接:http://pan.baidu.com/s/1skNaatR 密码:rjs2

       同样,如果百度链接挂了,就去CSDN中下载:ios-minicap

       如果使用存在问题,应该是路径问题,检查CMakeLists.txt中路径是否更改自己的 ios-minicap的本地路径。

iOS-remote 安装篇

       iOS-remote 安装篇之 ios-minicap 安装使用完全指南

       iOS-remote 安装篇之 WebDriverAgent 安装使用完全指南

       iOS-remote 安装篇之 iOS-remote安装使用完全指南

参考文献

       iOS-minicap + WDA 实现 ios 远程真机测试  https://testerhome.com/topics/10262

       基于 WebDriverAgent 的 iOS 远程控制  https://testerhome.com/topics/8890

       iOS 远程真机 (仅限屏幕查看)  https://testerhome.com/topics/6470

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值