I wanna build a automatic iOS app test framework. I can record the touch event by IOHIDFamily, so any way to replay this?
I tried GSEvent like this
void sendclickevent(){
mach_port_t thePortOfApp = GSCopyPurpleNamedPort("com.fuckyou.fuck");
GSEventRecord header;
GSHandInfo click;
GSPathInfo pathInfo = {2,2,2,1,1,{50,50}, NULL};
bzero(&header, sizeof(header));
bzero(&click, sizeof(click));
header.type = kGSEventHand;
header.subtype = kGSEventSubTypeUnknown;
header.location.x = 50;
header.location.y = 50;
header.windowLocation.x = 50;
header.windowLocation.y = 50;
header.infoSize = sizeof(GSHandInfo)+sizeof(GSPathInfo);
header.timestamp = mach_absolute_time();
click.type = kGSHandInfoTypeTouchDown;
click.deltaX = 1;
click.deltaY = 1;
click.pathInfosCount = 1;
struct
{
GSEventRecord record;
GSHandInfo hand;
GSPathInfo path;
} record = {header, click, pathInfo};
GSSendEvent(&record, thePortOfApp);
}
thePortOfApp return Non-Zero. But at end of this function, such as press a button, nothing happpend. So something wrong? or I need another way to send touch event to iOS UI?