简体   繁体   English

以编程方式锁定和解锁iPhone(而不是越狱)屏幕?

[英]Programmatically lock and unlock iPhone (not jailbroken) screen?

Can we programmatically lock and unlock Screen of the iPhone? 我们可以通过编程方式锁定和解锁iPhone的屏幕吗?

Heard of GSEventLockDevice() (private API) from GraphicsServices.framework but is not working in higher iOS versions. 听说过GraphicsServices.framework的GSEventLockDevice()(专用API),但在更高的iOS版本中无法使用。

Please checkout the following video: https://vimeo.com/188356953 请查看以下视频: https : //vimeo.com/188356953

Don't know how the iPhone screen is getting locked programatically in Cellcontrol ! 不知道如何在Cellcontrol中以编程方式锁定iPhone屏幕! Any ideas are welcomed ! 任何想法都欢迎!

We can't lock the screen programmatically without any private API but your requirement can achieve by sending keyboard events from paired bluetooth hardware devices. 没有任何私有API,我们无法以编程方式锁定屏幕,但是您的要求可以通过从配对的蓝牙硬件设备发送键盘事件来实现。

Please check this link Force lock screen 请检查此链接强制锁定屏幕

There is no documentation given by Apple to do it. 苹果公司没有提供任何相关文档。 But there are some private API's which can be possible to do it but it is not accepted by Apple when you submit your app to AppStore. 但是,有一些私有API可以实现,但是当您将应用程序提交给AppStore时,Apple不接受它。

So be specific on it whether you are going to submit in AppStore or Private purpose. 因此,无论您打算以AppStore还是私人目的提交,都应具体说明。

But you can keep your device unlock from auto lock by using the below line. 但是,您可以使用以下行来防止设备从自动锁定中解锁

[UIApplication sharedApplication].idleTimerDisabled = YES;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM