views:

65

answers:

2

Hi all,

I had used the following code to prevent the iPhone from entering the sleep mode.

  [UIApplication sharedApplication].idleTimerDisabled=YES

But is it possible to put the iphone in Sleep mode programatically ?

Thanks

+1  A: 

No it's not. That is up to the user to decide to do, or not, or when the idle timer is is hit.

Remember, Apple is a consumer-oriented company, where the products are consumer oriented. Developers are more "engineers" than consumers. Yes we consume to, but in different ways. Can you imagine the look on a normal users face if the phone mysteriously shuts off while they're using it? Even if they did tap a button to do it in your app, for instance. It's still non-uniform, and uniformity has been Apple's bread and butter for years.

jer
A: 

No sir, we just can't do it cap'n... we don't... have.. the power.

That's just another thing Apple doesn't want us tinkering with.

iWasRobbed
Quite right too. If I had an iPhone, I'd want it to go to sleep under my control, not the control of some programmer that thinks he knows better than me how to use my phone. I'm not massively happy that it's possible for an app to keep a phone awake without asking me.
JeremyP