Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 694
  • Last Modified:

how to refresh my iPhone application

Dear All,

i created an application with timer to show clock the application is working fine on the iPhone after 20 seconds the iPhone will go in to sleep mode the application still working on the background but the time stop and the clock will not be correct, i did my research and i found that i can refresh the application using :

applicationdidbecomeactive  function to refresh the UI interface but am not able find how my question here how i can disable the sleep mode while my application is running to prevent the iPhone from going into sleep, how i can refresh my application like it started from the scratch using applicationdidbecomeactive function

Best regards

1 Solution
When your application starts, add this line of code:

[UIApplication sharedApplication].idleTimerDisabled = YES;

Open in new window

When it closes, add this code:

[UIApplication sharedApplication].idleTimerDisabled = NO;

Open in new window

This will disable the auto-lock feature, as you would like.
deniro1974Author Commented:
can you please explain more where i can use this code in which function on the appdelegate or in the viewcontroller ?

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now