ret70 / ptfaketouch Goto Github PK
View Code? Open in Web Editor NEWSimulate touch events for iOS[User mode]
Simulate touch events for iOS[User mode]
Steps to reproduce
I've researched the issue a bit. After locking the iPhone all touches in touchAry have phase 'UITouchPhaseCancelled'
Found solution: in + (NSInteger)getAvailablePointId
treat touch with phase UITouchPhaseCancelled
as available (as Ended/Stationary are)
当弹出键盘的时候模拟点击无法点击键盘, 这个貌似要修复下
I have integrated framework of PTFakeTouch, when I run it on device it shows error saying "Code sign error : bundle format unrecognized, invalid, or unsuitable", and when I run the same in simulator it says error: Invalid bitcode signature, and gives warning missing required architecture x86_64 in IOKIT.framework.
I have included PTFakeTouch.Framework & IOKit.Framework in my project, which I got when I build the PTFakeTouch project. I have just added the team in your project.
And rest everything was same, as mentioned in your GitHub link.
+ (void)load{
KW_ENABLE_CATEGORY(UITouch_KIFAdditions);
KW_ENABLE_CATEGORY(UIEvent_KIFAdditions);
touchAry = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i<100; i++) {
UITouch *touch = [[UITouch alloc] initTouch];
[touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded];
[touchAry addObject:touch];
}
}
为何要在load的时候预先制造100个UITouch对象出来,为了之后的点击复用?防止每次创建新的对象?
如果是这样的话,创建100个,为何在getAvailablePointId时又只用到50个?
for (NSInteger i=0; i<touchAry.count-50; i++) {
UITouch *touch = [touchAry objectAtIndex:i];
if (touch.phase==UITouchPhaseEnded||touch.phase==UITouchPhaseStationary) {
[availableIds addObject:@(i+1)];
}
}
上面的代码还有个疑问,UITouchPhaseStationary阶段的UITouch拿出去复用真的好吗?如果把它复用成UITouchPhaseBegan,逻辑不通啊 <--- 看错了,这里没问题,后面在复用成UITouchPhaseBegan的时候会重新创建新的UITouch对象
怎么能触发控件的点击事件?
怎么获取界面控件属性?
Does this framework support simulator?
I'm using XCode 10.0.
Undefined symbols for architecture x86_64:
"_IOHIDEventCreateDigitizerEvent", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventCreateDigitizerFingerEventWithQuality", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventSetIntegerValue", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventAppendEvent", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file /Users/Alvin/Downloads/PTFakeTouch-master/IOKit.framework/IOKit.tbd, missing required architecture x86_64 in file /Users/Alvin/Downloads/PTFakeTouch-master/IOKit.framework/IOKit.tbd (3 slices)
Undefined symbols for architecture x86_64:
"_IOHIDEventCreateDigitizerEvent", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventCreateDigitizerFingerEventWithQuality", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventSetIntegerValue", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
"_IOHIDEventAppendEvent", referenced from:
_kif_IOHIDEventWithTouches in PTFakeTouch(IOHIDEvent+KIF.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
大神们 ... 我想在一个tweak里面调用 要怎么写
Dear Developer,We identified one or more issues with a recent delivery for your app, "XXXX. Please correct the following issues, then upload again. Non-public API usage - The app references non-public symbols in XXXMoudle: _IOHIDEventAppendEvent, _IOHIDEventCreateDigitizerEvent, _IOHIDEventCreateDigitizerFingerEventWithQuality, _IOHIDEventSetIntegerValue. If method names in your source code match the private Apple APIs listed above
集成到项目中是否可以通过App Store审核
实在是不知道怎么加入到项目中,为什么不能给个demo呢
同一套代码在同一个App iOS12上可以正确点击,但是iOS15点击后没有反应
求大佬帮忙看看什么情况
如题,如果可以,我就可以放心用在项目里了
Hi man! Thank you for these samples!
Do you have an idea - why click doesn't work for keyboard?
Keyboard just disappears.
And maybe do you know - how to fix it?
(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent )event
{
UITouch touch = [touches anyObject];
CGPoint originalLocation = [touch locationInView:self];
originalLocation.x = 10;
NSInteger pointId = [PTFakeMetaTouch fakeTouchId:[PTFakeMetaTouch getAvailablePointId] AtPoint:originalLocation withTouchPhase:UITouchPhaseBegan];
[PTFakeMetaTouch fakeTouchId:pointId AtPoint:originalLocation withTouchPhase:UITouchPhaseBegan];
}
(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent )event
{
UITouch touch = [touches anyObject];
CGPoint originalLocation = [touch locationInView:self];
originalLocation.x = 10;
NSInteger pointId = [PTFakeMetaTouch fakeTouchId:[PTFakeMetaTouch getAvailablePointId] AtPoint:originalLocation withTouchPhase:UITouchPhaseMoved];
[PTFakeMetaTouch fakeTouchId:pointId AtPoint:originalLocation withTouchPhase:UITouchPhaseMoved];
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent )event
{
UITouch touch = [touches anyObject];
CGPoint originalLocation = [touch locationInView:self];
originalLocation.x = 10;
NSInteger pointId = [PTFakeMetaTouch fakeTouchId:[PTFakeMetaTouch getAvailablePointId] AtPoint:originalLocation withTouchPhase:UITouchPhaseEnded];
[PTFakeMetaTouch fakeTouchId:pointId AtPoint:originalLocation withTouchPhase:UITouchPhaseEnded];
}
左边的列表无法滚动。
RT,在键盘弹起的情况下,模拟点击键盘无效
键盘的QuickType bar的信息貌似无法点击到,比如验证码之类的。
挺不错的framework.
但是有键盘的时候还是不行啊..
直接点到下面的window去了 ..
确定修复了么 ...
作者是用了 KIF 的扩展分类,但代码比较老旧了。如果遇到 iOS 14 以上用不了的话,可以把 kif 的相关代码同步过去即可。
缺少KIFTestActor.h
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.