dismissViewControllerAnimated completion block is not called
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()
Peter Warbo
I work as IT consultant in Gothenburg, Sweden, doing mobile development mostly for iOS.
Updated on July 20, 2022Comments
-
Peter Warbo almost 2 years
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];