iOS Private API:锁定设备并关闭屏幕电源 [英] iOS Private API: lock device and power off the screen

查看:188
本文介绍了iOS Private API:锁定设备并关闭屏幕电源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为越狱制作应用,以便在用户启动应用时锁定设备。我已经尝试 GSEventLockDevice(); 来自 GraphicsServices.framework 但这不能正常工作,因为它会锁定屏幕但是不会关闭屏幕电源。是否有其他方法可以在没有 MobileSubstrate 的情况下锁定屏幕?

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?

推荐答案

作为另一种选择,查看此答案,该答案使用 SBDimScreen()。您可以将 GSEventLockDevice()结合使用。

Just as another alternative, check out this answer, which uses SBDimScreen(). You could use that in conjunction with GSEventLockDevice().

看来你好了可能现在(iOS 5+)需要向您的应用添加权利才能成功使用此调用。如果您之前没有这样做,请这是一个如何操作的示例。显然,在这种情况下,有问题的权利必须更改为 com.apple.backboard.client

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.

您也可能会看到@VictorRonin是否已对此进行过实验,因为他对我链接的问题进行了评论。我在越狱的iOS 4.2.1设备上测试了 SBDimScreen(),但我的新设备目前无法运行此测试。我稍后会在iOS 5.x上试用并发布更新。

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.

注意:我从Elias链接到的答案有一个<强大的>不同的完全适用于iOS 6。

Note: the answer I linked to from Elias has a different call altogether for iOS 6.

这篇关于iOS Private API:锁定设备并关闭屏幕电源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆