I want to dismiss all alert view and action sheet like control if my apps moves to background so i put this code in objective c
- (void)applicationDidEnterBackground:(UIApplication *)application
{
Class AVClass = [UIAlertView class];
Class ASClass = [UIActionSheet class];
for (UIView * subview in subviews){
NSLog(@"the class is %@",[subview class]);
if ([subview isKindOfClass:AVClass]){
[(UIAlertView *)subview dismissWithClickedButtonIndex:[(UIAlertView *)subview cancelButtonIndex] animated:NO];
} else if ([subview isKindOfClass:ASClass]){
[(UIActionSheet *)subview dismissWithClickedButtonIndex:[(UIActionSheet *)subview cancelButtonIndex] animated:NO];
} else {
[self checkViews:subview.subviews];
}
}
}
but nothing happen i did not getting any alert view refrence in ios 8 Please suggest how to remove open Alert view .