Your code is not valid in iOS7 because [UIApplication sharedApplication].windows
doesn't have reference to UIAlertView
since the UIAlertView
itself is never added to any window in iOS7.
You need to keep reference to your actionSheet, this is best thing you can do.
You can do this with a reference to https://stackoverflow.com/a/19275311/1262634:
Class UIAlertManager = NSClassFromString(@"_UIAlertManager");
UIAlertView *alertView = [UIAlertManager performSelector:@selector(topMostAlert)];
Edit: this is a private API.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…