Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dismissViewControllerAnimated completion block is not called

I'm trying to dismiss a view controller like this:

[composeViewController dismissViewControllerAnimated:YES completion:^{

    NSLog(@"Hello"); // Never outputted
}];

The view controller is dismissed, but for some reason the completion block is never called.

I have never had any issues with completion block not being called with other view controllers.

This view controller is "special" though, because it's added as a child view controller (which I have not worked with previously in my app). Does this impose any side effects why the completion block is not called?

It's added like this:

UIViewController *rootVC = [UIApplication sharedApplication].delegate.window.rootViewController;
[rootVC addChildViewController:self];
[rootVC.view addSubview:self.view];
[self didMoveToParentViewController:rootVC];
like image 432
Peter Warbo Avatar asked Jun 26 '13 08:06

Peter Warbo


1 Answers

Found out what the issue was: the 3rd party view controller I was using had overridden - (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion without actually calling completion()

like image 110
Peter Warbo Avatar answered Nov 14 '22 02:11

Peter Warbo