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 @@ -52,6 +52,9 @@ + (void)showAlertWithTitle:(NSString *)title
5252
5353 UIWindow *keyWindow = [UIApplication sharedApplication ].keyWindow ;
5454 UIViewController *viewController = keyWindow.rootViewController ;
55+ while (viewController.presentedViewController ) {
56+ viewController = viewController.presentedViewController ;
57+ }
5558
5659 [viewController presentViewController: alertController animated: YES completion: nil ];
5760 } 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