I present modal view which is a navigation controller:
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:photoEditVC];
[self presentViewController:nvc animated:YES completion:NULL];
Once I'm done with the modal view, inside nvc's visible controller:
[self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
Result
Any ideas why this could happen?
UPDATE: I realized this only happens when before dismissing the view, I update a value in a shared singleton class, I use to keep track of events.
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
[self dismissViewControllerAnimated:YES completion:NULL];
But it works fine if I do this:
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
}];
or I can do this and it also works fine:
[self dismissViewControllerAnimated:YES completion:^{
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
}];
At the time, no other classes observer that variable so I do not understand why it would affect the modal view.
Not sure that this is causing the black screen, but the presented view controller should call dismissViewController on itself, not on the presenting view controller.
[self dismissViewControllerAnimated:YES completion:nil];
I saw this issue with iOS 8 GM. Dismissing with animated set to NO did the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With