Is there any way other than using GSEvent to fake touch events on iOS 7 devices?

1.1k views Asked by At

I need to fake the touch events on iOS 7 devices.I've gone through some of the resources available but could not find anything that says about iOS 7.

Below is what i set out to achieve:
An iOS background code running on iOS 7 device which will listen on a socket, to which client side app will send mouse key presses which are converted into touch/swipe etc. events.

I've gone through this link http://blog.lazerwalker.com/blog/2013/10/16/faking-touch-events-on-ios-for-fun-and-profit as well but here also it is said that GSEvent will fail silently in iOS 7.

Please let me know if there is a way to achieve this.

1

There are 1 answers

3
l0gg3r On

Check out ControlFreak.
So after adding and importing it, you can perform touches

- (void)performTouchInView:(UIView *)view
{
    UITouch *touch = [[UITouch alloc] initInView:view];
    UIEvent *eventDown = [[UIEvent alloc] initWithTouch:touch];

    [touch.view touchesBegan:[eventDown allTouches] withEvent:eventDown];

    [touch setPhase:UITouchPhaseEnded];
    UIEvent *eventUp = [[UIEvent alloc] initWithTouch:touch];

    [touch.view touchesEnded:[eventUp allTouches] withEvent:eventUp];
}

Also you can specify point for touch

UITouch *touch = [[UITouch alloc] initInView:view xcoord:100 ycoord:100];