Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Parse/Internal/PFAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ + (void)showAlertWithTitle:(NSString *)title

UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIViewController *viewController = keyWindow.rootViewController;
while (viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}

[viewController presentViewController:alertController animated:YES completion:nil];
} else {
Expand Down
1 change: 1 addition & 0 deletions Tests/Unit/AlertViewTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ - (void)testShowAlertWithAlertViewController {
id mockedApplication = PFStrictClassMock([UIApplication class]);
UIWindow *mockedWindow = PFStrictClassMock([UIWindow class]);
UIViewController *mockedViewController = PFStrictClassMock([UIViewController class]);
OCMStub(mockedViewController.presentedViewController).andReturn(nil);

// Using .andReturn() here will result in a retain cycle, which will cause our mocked shared application to
// persist across tests.
Expand Down