simulateTouch 怎么在注入 Springboard的时候点击我app呢 #127426
Replies: 1 comment
-
Hi @lengfeng222, thanks for participating! Unfortunately, we don’t currently have moderators for languages other than English. Until that changes, we need to ask that everyone use English here in the GitHub Community when posting to ensure discussions are adhering to our Code of Conduct. We’ll be locking this post for now, but please feel encouraged to create a new discussion in English if you still need support. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Product Feedback
Body
#import "TouchSimulator.h"
#import <UIKit/UIKit.h>
#import <dlfcn.h>
#import <mach/mach_time.h>
static void postEvent(IOHIDEventRef event);
static void execute();
static IOHIDEventRef parent = NULL;
void simulateTouch(int type, float x, float y) {
NSLog(@"冷风牛逼 - simulateTouch - 类型: %d, X: %f, Y: %f", type, x, y);
}
static UIWindow* getKeyWindow() {
for (UIWindow *window in [UIApplication sharedApplication].windows) {
if (window.isKeyWindow) {
return window;
}
}
return NULL;
}
static void postEvent(IOHIDEventRef event) {
static IOHIDEventSystemClientRef ioSystemClient = nil;
if (ioSystemClient == NULL) {
ioSystemClient = IOHIDEventSystemClientCreate(kCFAllocatorDefault);
NSLog(@"冷风牛逼 - 创建 IOHIDEventSystemClient");
}
if (event != NULL) {
IOHIDEventSystemClientDispatchEvent(ioSystemClient, event);
NSLog(@"冷风牛逼 - 事件已发送");
}
}
static void execute() {
UIWindow* keyWindow = getKeyWindow();
if (keyWindow != NULL) {
NSLog(@"冷风牛逼 - 获取到主窗口: %@", keyWindow);
} else {
NSLog(@"冷风牛逼 - 未能获取到主窗口");
}
}
void simulateSwipe(float startX, float startY, float endX, float endY, int steps) {
float stepX = (endX - startX) / steps;
float stepY = (endY - startY) / steps;
}
Beta Was this translation helpful? Give feedback.
All reactions