3

GSSendEvent does not work anymore for me.

Even subscribing a callback function using GSEventRegisterEventCallBack does not fire with touch events, [UIEvent _gsEvent] returns NULL.

What happened?

Bhanu
  • 1,249
  • 10
  • 17
storoj
  • 1,851
  • 2
  • 18
  • 25
  • Most likely these API's got protected by entitlement. However, I don't know an alternative way of simulating system wide touches. – Victor Ronin Sep 30 '13 at 13:32

1 Answers1

7

Now iOS uses IOHIDEvent (in IOKit.framework) for touch events.

backboardd create touch events and sent to SpringBoard, and SpringBoard receives it by UIApplicationHandleEventQueue

Anyway, if you have jailbroken device and want to simulate touch, just use SimulateTouch library. You can download it from Bigboss's repo, and API info is here http://api.iolate.kr/simulatetouch/

Also, this is open source. https://github.com/iolate/SimulateTouch

iolate
  • 91
  • 2
  • Is there a non-jailbreak alternative? I've also asked this at http://stackoverflow.com/questions/19471572/inject-system-wide-touch-events-on-ios7 – Ben Dowling Oct 19 '13 at 21:55
  • @BenDowling If you can get top application's task port(see SimulateTouch's source - [SimulateTouch.mm](https://github.com/iolate/SimulateTouch/blob/master/SimulateTouch.mm) ), I think you can. But I don't know how can get it from apps. – iolate Oct 20 '13 at 01:41
  • why just enter key submit comment! :( anyway, [CAWindowServer serverIfRunning] is working only on backboardd. [CAWindowServer server] works widely, but cannot get task port.. – iolate Oct 20 '13 at 01:45
  • oh my mistake.. It seems that cannot simulate even get task port.. :( – iolate Oct 30 '13 at 11:56
  • and for sending events like for example the old kGSEventMenuButtonDown? – Usi Usi Jan 11 '14 at 12:57
  • I have seen your code @iolate but i dont get how to use this for simulating touch events. I dont know much about jailbroken developement, so can you please give me step wise step, how to simulate systemwide touch events, thanks in advance – Mehul Thakkar Feb 13 '14 at 13:05
  • @iolate same way like touch i also want to inject keyboard events in ios 7. for that i created IOHIDEventRef keyEvent = IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, timeStamp,12,64,YES,kIOHIDEventOptionIsAbsolute); but this is not working for me. – priyanka Feb 28 '14 at 07:46
  • @iolate, I try to simulate keyboard event, it works only at home screen, but doesn't work inside other apps, I think the problem is `task port`, maybe the keyboard events should be sent to home screen application how can I get the `task port` of home screen application?Thank you. – Suge Mar 11 '14 at 14:09
  • @Suge you are talking about H/W key or keyboard. if you want to simulate H/W key event then use following code IOHIDEventSystemConnectionRef systemConnection = [manager clientForBundleID:@"com.apple.springboard"]; no task port required. – priyanka Mar 31 '14 at 11:52
  • @isolate can you please contact, skype name: live:.cid.2b66f62956c82daa – Waleed Mohsin Aug 14 '20 at 13:27