Reputation: 26223
I am trying to test an application that needs to run over an extended period of time and to aid initial testing I am trying to find a way to stop iOS moving the application to the background and suspending it. Ultimately I will add code to facilitate the use of multi-tasking but right now I just want to better test the core mechanics without iOS pushing it into the background all the time.
Upvotes: 1
Views: 983
Reputation: 70703
As long as you, the user, don't stop this app, launch another app, or lock the device:
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
might keep your app running in the foreground. Don't forget to re-enable the idle timer, or this could keep the device running until the battery is dead.
Upvotes: 3
Reputation: 57179
You can not prevent ios from suspending an app. The home button will close/resign active the application and even if you request for a background task apple can kill your app at any time as it sees necessary (More than likely for memory reasons).
Upvotes: 5