按照狗神的干货分享用SimulateTouch模拟点击及滑动出错

使用iOSOpenDev开发ipad min ios7.1.2测试无效,于是打算用theos 于是按照http://bbs.iosre.com/forum.php?m … =296&extra=page%3D1方法,但是make出错,
xiaomindeiMac:iosretouch xiaomin$ make
Making all for tool iOSRETouch…
make[2]: Nothing to be done for `internal-tool-compile’.

makefile文件内容如下,我选择的是 [8.] iphone/tool这个模板
THEOS_DEVICE_IP = localhost
THEOS_DEVICE_PORT = 2222
ARCHS = armv7 armv7s arm64
TARGET = iphone:7.1:6.0

include theos/makefiles/common.mk

TOOL_NAME = iOSRETouch
iOSRETouch_FILES = main.mm
iOSRETouch_LDFLAGS = -lsimulatetouch # 这里必须链接libsimulatetouch.dylib

include $(THEOS_MAKE_PATH)/tool.mk

已经把libsimulatetouch.dylib放入lib内。

原来是不小心懂了control文件,重新新建工程就好
xiaomindeiMac:iosretouch xiaomin$ make package
Making all for tool iOSRETouch…
Compiling main.mm…
Linking tool iOSRETouch…
Stripping iOSRETouch…
Signing iOSRETouch…
Making stage for tool iOSRETouch…
dpkg-deb:正在新建软件包“com.yourcompany.iosretouch”,包文件为“./com.yourcompany.iosretouch_0.0.1-1_iphoneos-arm.deb”。
xiaomindeiMac:iosretouch xiaomin$ make package install
Making all for tool iOSRETouch…
make[2]: Nothing to be done for `internal-tool-compile’.
Making stage for tool iOSRETouch…
dpkg-deb:正在新建软件包“com.yourcompany.iosretouch”,包文件为“./com.yourcompany.iosretouch_0.0.1-2_iphoneos-arm.deb”。
install.exec “cat > /tmp/_theos_install.deb; dpkg -i /tmp/_theos_install.deb && rm /tmp/_theos_install.deb” < “./com.yourcompany.iosretouch_0.0.1-2_iphoneos-arm.deb”
ssh: connect to host localhost port 2222: Connection refused
make: *** [internal-install] Error 255
但是编译还是出错,估计与ssh链接端口什么的有关系不懂

你买书了吗?Theos部分看了吗?

书买了,还买了kindle版的,书上的例子都弄了一遍的,明白错误原因了,重新建个工程就没问题了,估计不小心改了control文件,还有访问端口被拒绝,估计是权限问题,不能直接打包再并且安装,我就make package,然后把那些可执行文件丢到了usr/bin目录下面。哎,还说不能打包并且安装啊,

问题1:
xiaomindeiMac:iosretouch xiaomin$ make package install
Making all for tool iOSRETouch…
make[2]: Nothing to be done for `internal-tool-compile’.
Making stage for tool iOSRETouch…
dpkg-deb:正在新建软件包“com.yourcompany.iosretouch”,包文件为“./com.yourcompany.iosretouch_0.0.1-2_iphoneos-arm.deb”。
install.exec “cat > /tmp/_theos_install.deb; dpkg -i /tmp/_theos_install.deb && rm /tmp/_theos_install.deb” < “./com.yourcompany.iosretouch_0.0.1-2_iphoneos-arm.deb”
ssh: connect to host localhost port 22: Connection refused
make: *** [internal-install] Error 255
问题2
ipad mini7.1.2不能用那个触摸的,用theos和iOSOpenDev都试过不行, 别的设备可以用,然后这个mini出错原因如下,原因正在查找当中
Dec 25 09:41:37 xiaominde-iPad Clash of Clans[1747] : ST Error: simulateTouch:atPoint:withType: index:0 type:1 pathIndex:0
Dec 25 09:41:37 xiaominde-iPad Clash of Clans[1747] : iOSREError: Simutale touch down failed at (0, 0).
Dec 25 09:41:37 xiaominde-iPad Clash of Clans[1747] : ST Error: simulateTouch:atPoint:withType: index:0 type:2 pathIndex:0
Dec 25 09:41:37 xiaominde-iPad Clash of Clans[1747] : iOSREError: Simutale touch up failed at (0, 0).

问题1应该是iOS没装OpenSSH,问题2论坛里有讨论,好像是设备尺寸问题

在郁闷与纠结中度过了终于可以用了,总结一下,大概就是源码有两份工程,外加一个测试工程,
分别是tweak和库(选9个模板中的第4个),然后把编译完毕的库丢到usr/lib内,而 SimulateTouch.dylib和SimulateTouch.plist丢到DynamicLibraries内,然后那个main.mm使用tool模板编译完了就到usr/bin,然后就可以测试了,注意哦,保证你设备上的触摸一类的程序可以运行,因为有些东西可能会被他卸载的时候卸载掉

多谢 QQ昵称叫 Glaber的大哥,

@hole 请教几个问题
我下载了最新的SimulateTouch.h文件和libsimulatetouch.dylib库,添加到我自己的Logos Tweak工程中,编译是通过了,但是调用
int r = [SimulateTouch simulateTouch:0 atPoint:touchPoint withType:STTouchDown];
r = [SimulateTouch simulateTouch:r atPoint:touchPoint withType:STTouchUp];
并没有触发点击,我应该怎么样才能在自己的工程中使用点击这个方法呢

请问你解决这个问题了吗?

这个问题有解决吗?

终于搞定了,在theos 和 iosOpenDev上搞了很久,最后是点的位置问题

theos 和 iosOpenDev 都是可行的