Code Snippet: Prevent The iPhone From Sleeping

    • Tweet
    July 22nd, 2009 Posted by: - posted under:Snippets

    The code below will prevent the iPhone from dimming its screen and ultimately going to sleep. Use it wisely as you don’t want your application becoming notorious for being a battery hog

    [UIApplication sharedApplication].idleTimerDisabled = YES;

    Happy iCoding!