A system warning is usually displayed in its own UIWindow . Set up handlers for notifications UIWindowDidBecomeVisibleNotification and UIWindowDidBecomeHiddenNotification to track when the UIWindow becomes visible and hidden respectively:
  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aWindowBecameVisible:) name:UIWindowDidBecomeVisibleNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aWindowBecameHidden:) name:UIWindowDidBecomeHiddenNotification object:nil]; 
In the handlers, take UIWindow , which will change the state from the object property of the notification:
 - (void)aWindowBecameVisible:(NSNotification *)notification { UIWindow *theWindow = [notification object]; NSLog(@"Window just shown: %@", theWindow); } - (void)aWindowBecameHidden:(NSNotification *)notification { UIWindow *theWindow = [notification object]; NSLog(@"Window just hidden: %@", theWindow); } 
Finally, make sure that theWindow contains a sub-item of type UIAlertView .
 source share