2

I want to simulate touch events on iOS 6. I learned something useful from IOHIDEvent, which is a low-level functions bundle for human interface devices.

From: https://github.com/kennytm/iphone-private-frameworks/tree/master/IOKit/hid I got the private framework with IOHIDEvent, but the headers were changed after iOS 4, and some functions were not supported any more.

Does anyone know how to get the functions in iOS6, or known how to simulate the events at system-level?

Nate
  • 31,017
  • 13
  • 83
  • 207
Suge
  • 2,808
  • 3
  • 48
  • 79
  • Does anybody got the answer for this question? I need to inject system wide touch in iOS8. I have already asked similar question here: http://stackoverflow.com/questions/26915920/ios8-touch-injection-programatically but nobody replied to it. I really need answer asap. – TechFlitter Nov 27 '14 at 22:03

3 Answers3

2

As I mentioned in my answer to your other question today, you might try looking at GSEvent.h from GraphicsServices.framework, or in IOKit.framework.

Here are some good answers on stackoverflow to help you:

iOS Private API: lock device and power off the screen

GSSendEvent - Inject Touch Event iOS

iOS touch event notifications (private API)

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
  • Thank you very much for your helpful answer!In fact I want to capture all the touch operatons of user, then play back them.I do not find a appropriate place to archive this, from the googling, I got IOHIDEvent was an effective way, so I tried it.It was useful but still with something wrong.GSEvent is a good way to simulate the touch event, but can it only send event to specified app? And can I capture events using GSEvent?Thank you! – Suge Jun 14 '13 at 10:37
  • If I understand you correctly, the answer is *"no, it's not only for sending to one app"*. You can send GSEventRecords to the system, using [GSSendSystemEvent()](http://stackoverflow.com/a/15997772/119114). Recording is a different question. I haven't had to do that before. You should probably post that as a **new** stack overflow question (e.g. "Recording iOS Touch Events with GraphicsServices"). I'm going to sleep for tonight, but if I have some time, I'll try to check back in tomorrow ... – Nate Jun 14 '13 at 10:54
  • Thank you very much!I'll post a new question. – Suge Jun 14 '13 at 10:56
  • I've post a new question here http://stackoverflow.com/questions/17107001/how-to-capture-and-record-ios-touch-events-at-system-level.Could you think about this question for me, I'm very appreciate. – Suge Jun 14 '13 at 11:03
  • Does you how to send systemwide touch events in ios 7 – Mehul Thakkar Feb 13 '14 at 13:13
  • @MehulThakkar, I have not tested this on iOS 7, no. Did you try the last link in my answer (from EntryLevelDev)? – Nate Feb 13 '14 at 18:07
  • I have seen that, but that is for capturing the x, y coordinate of touch event, not for sending the event – Mehul Thakkar Feb 13 '14 at 19:16
  • You'll need to search for another question that discusses iOS 7, or post a **new** question. Unfortunately, these APIs do change often with iOS releases. This question and answer are still useful for iOS 6, but going forward, we probably need a new question (if someone else has not already asked it). Thanks. – Nate Feb 13 '14 at 19:38
  • @Nate Please I finally get a solution with IOHIDEvent for iOS7 but it runs only on the simulator not on the device ... what's the problem if you have an idea PLz... I reached to limit question that's why I didn't ask a question – Dhekra Zaied Nov 14 '14 at 15:24
  • Does anybody got the answer for this question? I need to inject system wide touch in iOS8. I have already asked similar question here: http://stackoverflow.com/questions/26915920/ios8-touch-injection-programatically but nobody replied to it. I really need answer asap. – TechFlitter Nov 27 '14 at 22:03
-1

If you want to simulate touch events at the system level, you have to jailbreak your device.

Check this:

Simulate Touch Event on iOS - jailbroken - iOS13+

Is possible to simulate touch event using an external keyboard on ios jailbroken?

Jason Z
  • 39
  • 6
  • Your formatting choices are annoyingly noisy. I guess that is not the impression you want to make it stick out from the other posts. – Yunnosch Jul 22 '20 at 05:46