I'm making an app for jailbreak that lock the device when the user launch the app. I've tried GSEventLockDevice();
from GraphicsServices.framework
but this does not work properly because it locks the screen but does not power off the screen. Is there another way to lock the screen without MobileSubstrate
?

- 301
- 5
- 14
2 Answers
Just as another alternative, check out this answer, which uses SBDimScreen()
. You could use that in conjunction with GSEventLockDevice()
.
It appears that you may now (iOS 5+) need to add an entitlement to your app to use this call successfully. If you haven't done that before, here is an example of how to do so. Obviously, in this case, the entitlement in question must be changed to com.apple.backboard.client
.
You also might see if @VictorRonin has experimented with this, as he commented on the question I linked to. I tested SBDimScreen()
on a jailbroken iOS 4.2.1 device, but my newer devices are currently unavailable to run this test. I'll try it later on iOS 5.x and post an update.
Note: the answer I linked to from Elias has a different call altogether for iOS 6.
-
I'm learning MobileSubstrate, maybe is easier than this... Thanks! – Davide Di Febbo Feb 14 '13 at 10:12
-
1Hi @Nate, would you give me a hand for multi-touch simulating?Very appreciate it.http://stackoverflow.com/questions/17907811/how-to-simulate-multi-touch-with-gsevent – Suge Jul 28 '13 at 14:38
-
it's not working on IOS 7, instead console shows an warning (
: -[BKWorkspaceServerManager _handleEvent:] Unknown GSEvent, type = 1014; Ignoring. ) – M.Shuaib Imran Oct 21 '14 at 12:29 -
@ShabiTech, many private APIs stopped working (or began requiring entitlements) in iOS 7. If you want to know how to do this for iOS 7/8, you should post a **new** question. This question and answer should be preserved for historical purposes. If a new solution is needed for iOS 7, we need a separate question for that. Thanks. – Nate Oct 21 '14 at 21:19
Look at these several questions:
Simulating System Wide Touch Events on iOS
Simulating System Wide Touch Events in iOS without jailbreaking the device
How to send a touch event to iPhone OS?
The idea is that you can simulate system wide events. One of events is power down event. If you simulate it, it will turn off device and will lock it.
BTW. You may be interested to google more on GSEvent which is the key for even simulation.
Here are couple of useful links:
http://iphonedevwiki.net/index.php/GSEvent
http://networkpx.blogspot.com/2009/08/gsevent-recording-and-playback-in-30.html
Also, this approach isn't limited to jailbroken phones. It works on jailed phone too (however, you won't be able to post it to AppStore).

- 1
- 1

- 22,758
- 18
- 92
- 184
-
-
1Look at this. However, it could be outdate (I believe it was designed for iOS 3.0): http://code.google.com/p/hid-support/source/browse/trunk/hidspringboard/Tweak.xm?spec=svn82&r=82 – Victor Ronin Feb 13 '13 at 21:49
-
1@VictorRonin, would you do me a favor about multi-touch simulating?http://stackoverflow.com/questions/17907811/how-to-simulate-multi-touch-with-gsevent I very appreciate it. – Suge Jul 28 '13 at 14:34
-
1@Bob: Sorry, I have never tried multi-touch simulation. BTW. Be careful with this approach. People reported problems on iOS 7 – Victor Ronin Jul 29 '13 at 14:40
-
1@VictorRonin, thank you for answer,but what's the problems reported on iOS 7? – Suge Jul 30 '13 at 01:59
-
1@Bob: I saw following question and made assumption that Apple added entitlements to use this API http://stackoverflow.com/questions/17573572/gscopypurplenamedportappid-in-graphicsservices-is-deprecated-in-ios7 – Victor Ronin Jul 31 '13 at 18:26