Is it possible for my app to "take over" when a system alert pops up? My app disables the idle timer, but when a system alert pops up, the alert seems be enabling the timer. What can I do about that?
Asked
Active
Viewed 306 times
2 Answers
3
Would it be possible for you to hook into one of the methods that gets called when your app goes in and out of the background? Say, one of these?
- (void)applicationWillResignActive:(UIApplication *)application {
NSLog(@"applicationWillResignActive");
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
NSLog(@"applicationDidEnterBackground");
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
NSLog(@"applicationWillEnterForeground");
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"applicationDidBecomeActive");
}
I bet one of those gets called when that happens. You can probably disable the idle timer when your app gets the focus back.
EDIT: On re-reading the question, it looks like you're looking to suppress the alerts (i.e., not let them happen). Heh, I focused on the latter half of your question.

donkim
- 13,119
- 3
- 42
- 47
-
Read more details about what's going on here: http://stackoverflow.com/questions/4576204/help-with-why-my-app-crashed – Moshe Jan 01 '11 at 23:42
1
Are you trying to suppress the alerts? Then the answer is: you can't.
If you're trying to prevent the alerts from messing with your app's disabling of the idle timer, then I believe donkim is on the right trail.

Dave R
- 605
- 3
- 5
-
What about making the alerts resign the first responder status so that my app won't hang. A system alert makes the active app considered to be inactive, believe it or not. – Moshe Jan 02 '11 at 14:23
-
I don't believe you can get a handle on the alert, so no, you can't make it resign first responder. Your app needs to deal with being made inactive. – Dave R Jan 02 '11 at 19:31