Skip to content

Commit b44f04d

Browse files
author
Grant Robinson
committed
Fix when dismissing a promiseViewController
The proper way to dismiss a the viewController is to call dismissViewControllerAnimated:completion on vc2present.presentingViewController
1 parent 4caece1 commit b44f04d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Categories/UIKit/UIViewController+AnyPromise.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ @implementation UIViewController (PromiseKit)
1515

1616
- (AnyPromise *)promiseViewController:(UIViewController *)vc animated:(BOOL)animated completion:(void (^)(void))block
1717
{
18-
id vc2present = vc;
18+
UIViewController *vc2present = vc;
1919
AnyPromise *promise = nil;
2020

2121
if ([vc isKindOfClass:NSClassFromString(@"MFMailComposeViewController")]) {
@@ -72,8 +72,7 @@ - (AnyPromise *)promiseViewController:(UIViewController *)vc animated:(BOOL)anim
7272
[self presentViewController:vc2present animated:animated completion:block];
7373

7474
promise.finally(^{
75-
//TODO can we be more specific?
76-
[self dismissViewControllerAnimated:animated completion:nil];
75+
[vc2present.presentingViewController dismissViewControllerAnimated:animated completion:nil];
7776
});
7877

7978
return promise;

0 commit comments

Comments
 (0)