mixtly87
mixtly87

Reputation: 1695

How to test if UIAlertView is shown on iOS 8?

I'm writing Unit tests for my app and there seems to be a problem with getting shown UIAlertView.

On iOS 7, this used to work:

UIAlertView* alertView = [NSClassFromString(@"_UIAlertManager") performSelector:@selector(topMostAlert)]

but this doesn't work on iOS 8.

Is there a way visible UIAlertView can be retrieved on iOS 8?

Upvotes: 1

Views: 871

Answers (2)

ADS
ADS

Reputation: 23

Maybe it because iOS 8 use UIAlertController instead of UIAlertView.

Apple Developers Library "UIAlertController"

Upvotes: 0

Rohit
Rohit

Reputation: 1174

UIAlertView and UIActionSheet is combined in a class called UIAlertController in ios8. Kindly check the Apple Document

From Apple Doc

A UIAlertController object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts. After configuring the alert controller with the actions and style you want, present it using the presentViewController:animated:completion: method.

Upvotes: 4

Related Questions