iosobjective-cauto-lock

Auto lock does not function when app left open - iOS


I'm developing a messaging app and auto lock doesn't function when app left open. (No single line is related to auto lock in code)

I've used this line to enabling it,

[[UIApplication sharedApplication] setIdleTimerDisabled:NO]; 

but its not working.

Any idea how to get this done?


Solution

  • For anyone who is facing the same issue.

    The device will not lock when you are running app through X-code either debugging or not. Once app is installed you have to detach it from X-code( just remove the attached cable ), it will work for you.