File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed
Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ + (void)showAlertWithTitle:(NSString *)title
5656
5757 UIWindow *keyWindow = [UIApplication sharedApplication ].keyWindow ;
5858 UIViewController *viewController = keyWindow.rootViewController ;
59+ while (viewController.presentedViewController ) {
60+ viewController = viewController.presentedViewController ;
61+ }
5962
6063 [viewController presentViewController: alertController animated: YES completion: nil ];
6164 } else {
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ - (void)testShowAlertWithAlertViewController {
4444 id mockedApplication = PFStrictClassMock ([UIApplication class ]);
4545 UIWindow *mockedWindow = PFStrictClassMock ([UIWindow class ]);
4646 UIViewController *mockedViewController = PFStrictClassMock ([UIViewController class ]);
47+ OCMStub (mockedViewController.presentedViewController ).andReturn (nil );
4748
4849 // Using .andReturn() here will result in a retain cycle, which will cause our mocked shared application to
4950 // persist across tests.
You can’t perform that action at this time.
0 commit comments