python Mac ios 跳一跳
注意:目前的效果是可以跳出分,但是有时候不能上排行榜。
参考文章:
《微信跳一跳 mac + iphone 图文教程》
《iOS-Carthage 安装以及使用》
《iOS真机如何安装WDA》
《WeChat_jump_game》
《Android-和-iOS-操作步骤》
一,安装xcode
直接从Mac的App Store下载xcode。5个多G,先下着。
二,安装carthage
用Homebrew来安装carthage。Mac终端依次执行下列三条命令:
brew update
brew install carthage
carthage version
carthage version有值说明安装成功。
三,从Github下载WDA
WebDriverAgent 在 iOS 端实现了一个 WebDriver server ,借助这个 server 我们可以远程控制 iOS 设备。你可以启动、杀死应用,点击、滚动视图,或者确定页面展示是否正确。
Mac终端执行此命令从GitHub复制WDA源码:git clone https://github.com/facebook/WebDriverAgent.git
四,运行WDA初始化脚本
- 步骤:
终端cd到WebDriverAgent目录下
./Scripts/bootstrap.sh
如果运行这个命令提示:“Please make sure that you have npm installed Note: We are expecting that npm installed in /usr/local/bin/”
那么运行
brew install npm
- 可能报错:
xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH - 解决办法
打开Xcode
在Xcode中打开WebDriverAgent这个应用
点击Preferences
点击Locations
选择Command Lin Tools: (选择xcode版本)
五,安装 WDA
- 步骤1:
在Xcode上打开WDA这个项目,用数据线连接手机 - 可能报错:
Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator - 解决办法:
Product Scheme 选WebDriverAgentRunner - 步骤2:
点击product 运行 test 来安装 WebDriverAgent,快捷command+u - 可能报错:
Xcode PBXcp Error - No such file or directory - 解决办法:
在Xcode里面
双击项目名-选择WebDriverAgentRunner-build phases,然后从copy bundle resources里面删掉红色的错误资源文件。 - 可能报错:
“Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.” - 解决办法:
双击项目名-选择WebDriverAgentLib-general-team-选择自己的开发app ID
双击项目名-选择WebDriverAgentRunner-general-team-选择自己的开发app ID - 可能报错:
“Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 11.3'” - 解决办法:要输入钥匙串密码,就是你的Mac的密码,如果让你输入密码后又多次要求密码,不是因为错了,就是要输入很多次。
- 可能报错:
“ Failed to create provisioning profile. The app ID "com.facebook.WebDriverAgentRunner" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.” - 解决办法:
双击项目名-选择WebDriverAgentLib-build settings-product bundle identifier-在后面加上一个后缀(我加的身份证号码)
双击项目名-选择WebDriverAgentRunner-build settings-product bundle identifier-在后面加上一个后缀(我加的身份证号码) - 可能报错:
“could not launch "WDARunner",verify the Developer App certificate for your account is trusted on your device” - 解决办法:
手机:设置-通用-设备管理-开发者应用-信任 - 可能报错:
(Early unexpected exit, operation never finished bootstrapping - no restart will be attempted) - 解决办法:
双击项目名-选择WebDriverAgent-build settings-all-mach o type-选择dynamic library - 可能报错:
Library not loaded: @rpath/RoutingHTTPServer.framework/RoutingHTTPServer - 解决办法:
Go to TARGETS -> WebDriverAgentRunner -> Build Phases -> Copy frameworks
Add RoutingHTTPServer.framework - 可能报错:
command /usr/bin/codedesign failed with exit code 1 - 解决办法:
参考:http://www.jb51.net/article/102343.htm
六,端口转发
brew install libimobiledevice
终端输入 iproxy 8100 8100
浏览器 127.0.0.1:8100/status检测,出现json数据则成功
七,wechat_jump_game
去github下载项目
git clone https://github.com/wangshub/wechat_jump_game.git
安装一些需要的软件
pip3 install --pre facebook-wda
cd wechat_jump_game
pip3 install -r requirements.txt
如果这个没有安装成功,则在下面的步骤中需要哪个软件单独安装
如果要自动跳(自动跳目前是不行的)
拷贝 wechat_jump_game/config/iPhone 目录下对应的设备比如6s的配置文件,复制到wechat_jump_game 下并且重命名为config.json
手机上运行跳一跳,然后在终端执行脚本文件 python3 wechat_jump_auto_iOS.py
如果要手动版(分数刷上去了,但是有时候不进排行榜,微信会提示操作可疑)
(wechat_jump_iOS_py3.py 代码分析)
这个代码wechat_jump_iOS_py3.py第15行改一下,如果是6s就改为time_coefficient = 0.00196
这样跳得更加精确
jump()函数里面的 s.tap_hold(200, 200, press_time)改为
import random
a = random.randint(100, 400)
b = random.randint(100, 400)
s.tap_hold(a, b, press_time)
这样子就不会每次都在模拟在同一位置点按,减少被怀疑的概率
手机运行跳一跳,然后python3 wechat_jump_iOS_py3.py


八,怎么玩
- Xcode:在Xcode上打开WDA这个项目,用数据线连接手机,快捷command+u,控制台会出现一个ip和端口
- 端口转发:终端输入 iproxy 8100 8100
- 运行py:手机运行跳一跳,然后python3 wechat_jump_iOS_py3.py