I want to remove all UIAlertview in my application when i enter to background mode. I am using the following code to do that.
for (UIWindow* w in [UIApplication sharedApplication].windows)
for (NSObject *o in w.subviews)
{
if ([o isKindOfClass:[UIAlertView class]])
{
[(UIAlertView *)o dismissWithClickedButtonIndex:[(UIAlertView *)o cancelButtonIndex] animated:YES];
}
}
It is working properly in iOS6. When i run the same application in iOS7 device it is not working. Have any ideas?