I try to perform a segue programatically from one view to another, way after it's been loaded (server sends an order to proceed) but it won't happen because "whose view is not in view hierarchy". Any ideas on how to solve it?
P.S. I don't perform any segues from viewDidLoad() method, all of them are performed from a method which is also called from another method in this class (which reads a dictionary, sent from the server). Also I tried to perform segues like this
dispatch_async(dispatch_get_main_queue(), {
self.performSegueWithIdentifier("seg_wait_ready", sender: self)
})
and just like this (even though I know this is wrong):
performSegueWithIdentifier("seg_wait_ready", sender: self)
None of these work, I still get the same warning.
I solved this issue by changing the logic of how my application changes VCs. Now I do it directly through the delegate by doing the following (roughly):
delegate.window!.rootViewController = destinationViewController
It cost me all the system transition animations but I like to do custom ones anyway. But remember to keep it in main queue. To do it safe put it in the main queue manually like this:
dispatch_async(dispatch_get_main_queue(), {delegate.window! ... })