I've created an app using storyboard. I have few view controllers with navigation controllers. Now in the last of them I have a button, which is opening instagram login view controller (I'm using this library: https://github.com/OceanLabs/InstagramImagePicker-iOS ).
Here's a piece of code:
let loginVC = OLInstagramLoginWebViewController()
loginVC.redirectURI = GlobalConstants.instagramRedirectId
self.instagramLoginViewController = loginVC
self.instagramLoginViewController!.delegate = self
self.navigationController!.pushViewController(loginVC, animated: true)
Then it shows login view controller, I can type in user/password and finally it calls delegate that user was logged in, where I do this:
if(self.instagramLoginViewController != nil){
self.navigationController!.popViewControllerAnimated(false)
self.instagramLoginViewController = nil
}
And it actually pops login view controller, however something strange things are happening from now. When previous view controller shows up (yes I have it on the storyboard as well as the others) back button doesn't work as it should. On the navigation bar things are changing, but the rest of the screen is not changing until it reaches the very first view controller. I've checked code inside login view controller from that instagram library and removed that line:
[self.navigationItem setHidesBackButton:YES];
So the back button appears in login view controller too and when I click it everything work. So my conclusion is popViewControllerAnimated is the one, which cause the problem.
How should I fix that?
Damn, I don't know why, but I've changed
self.navigationController!.popViewControllerAnimated(false)
to
self.navigationController!.popViewControllerAnimated(true)
And now it works.. Strange.. I wanted to do it without an animation, but well..