File tree 2 files changed +4
-0
lines changed
2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ + (void)showAlertWithTitle:(NSString *)title
52
52
53
53
UIWindow *keyWindow = [UIApplication sharedApplication ].keyWindow ;
54
54
UIViewController *viewController = keyWindow.rootViewController ;
55
+ while (viewController.presentedViewController ) {
56
+ viewController = viewController.presentedViewController ;
57
+ }
55
58
56
59
[viewController presentViewController: alertController animated: YES completion: nil ];
57
60
} else {
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ - (void)testShowAlertWithAlertViewController {
44
44
id mockedApplication = PFStrictClassMock ([UIApplication class ]);
45
45
UIWindow *mockedWindow = PFStrictClassMock ([UIWindow class ]);
46
46
UIViewController *mockedViewController = PFStrictClassMock ([UIViewController class ]);
47
+ OCMStub (mockedViewController.presentedViewController ).andReturn (nil );
47
48
48
49
// Using .andReturn() here will result in a retain cycle, which will cause our mocked shared application to
49
50
// persist across tests.
You can’t perform that action at this time.
0 commit comments