Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable automatic screen lock in iOS 5.1

Tags:

ios

iphone

ios5.1

The following line of code prevents the app from automatically locking the screen after some idle time.

[UIApplication sharedApplication].idleTimerDisabled = YES; //write this in applicationDidFinishLaunching

It works well till iOS 5.0. But iOS 5.1 does not respect this line and locks the screen after some idle time. How to solve this irritating issue?

Thanks.

Edit:

The same code works fine when its installed in 5.0.1 device. But I dont know why it is not working with 5.1 device.

like image 634
Selvin Avatar asked Mar 28 '12 09:03

Selvin


People also ask

How do I turn off auto lock on iOS?

Go to Devices > Password Policy > iOS tab. Look for the Auto-Lock dropdown option and set it to "–" to disable auto-lock on the devices. Save the changes, and wait for a few seconds until the devices receive the new policy changes. On the iOS device, go to Settings > General > Auto-Lock.

How do I turn off automatic screen lock?

Turn off auto-lock (Android tablet) Open Settings. Tap the applicable menu option(s), such as Security or Security & location > Security, then locate and tap Screen lock. Select None.

How do I turn on auto lock on iOS?

Open the Settings app. Tap Display & Brightness. Select Auto-Lock. Set the timer to the time that works best for you.

Is there a way to disable the automatic screen lock?

There's definitely the option to disable the automatic screen lock in the device settings, just did it on of my testing devices. I can't imagine that there isn't a way to do this in Intune, but the only setting I can find for config profiles is the maximum number of minutes before automatic screen lock (which can be set to 15 max).

Why won't my iPhone screen lock automatically?

The setting you're referring to is " Maximum minutes of inactivity until screen locks" and it's under iOS device restrictions. Leave that setting "not configured" and then on your iOS device, go to Settings, Display and Brightness, then Auto-Lock.

How do I Turn OFF Auto lock on iOS?

Leave that setting "not configured" and then on your iOS device, go to Settings, Display and Brightness, then Auto-Lock. Set that to "Never". The device will never automatically lock again. We don't currently have the ability to set it to "Never" via the service. That's what I figured, thanks for the quick reply! :)

How to disable Camera on iPhone lock screen?

Here, simply use the toggle to disable “Camera” on your iPhone, as shown in the screenshot below. Once disabled, you won’t see the Camera app on the iOS home screen. The camera shortcut in the lock screen will be grayed out too. Assuming you followed along properly, you have disabled the camera on your iPhone or iPad and the devices lock screen.


2 Answers

Just setting [UIApplication sharedApplication].idleTimerDisabled = YES; in

- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

works well for me. However, there is a caveat. I have noticed that every time I invoke camera utility to take a snapshot, idleTimerDisable gets set to NO behind the scene. So right after I upload my image, I had to call the following line of code again:

[UIApplication sharedApplication].idleTimerDisabled = YES;

I would not be surprised if there are more places throughout that require same strategy. So far this approach has worked without issues for me.

like image 152
Aki Avatar answered Oct 24 '22 10:10

Aki


[[UIApplication sharedApplication] setIdleTimerDisabled: YES];

worked for me on iOS 5.1

like image 24
orkoden Avatar answered Oct 24 '22 08:10

orkoden