سؤال

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?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top