What could cause pushViewController to be extremely slow? (it takes 30+seconds for the new view to appear)
Basically, I'm doing something like this:
SecondViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"correctID"];
vc.something = something;
[self.navigationController pushViewController:vc animated:YES];
CLS_LOG(@"Pushed Controller...");
and i'm logging at the beginning of viewdidload inside the second view controller. I'm not subclassing other methods.
Between Pushed Controller... and the next log from viewdidload there's a huge delay.
How would you debug this?
I already tried with the TimeProfiler but apparently it shows nothing.
Dino's answer saved my life. He got my upvote. I'm just adding this for modern swift users.
DispatchQueue.main.async {
self.navigationController?.pushViewController(vc, animated: true)
}
Had similar problem before, try the following
dispatch_async(dispatch_get_main_queue(), ^{
// your navigation controller action goes here
});
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