jeudi 11 juin 2015

Swift dismiss OAuth view

I have an app that logs into a 3rd party API via Oauth but I need some help removing my authorize view after successfully getting the token. Here's what I've got for the IB: enter image description here

The app starts up with the regular ViewController and if there's no authToken presents the AuthView:

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        if (myVars.authToken == "" ) {
            let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
            let authVC = storyboard.instantiateViewControllerWithIdentifier("AuthViewController") as! AuthViewController
            self.navigationController?.showViewController(authVC, sender: self)
        }

You tap authorize, it opens the URL in Safari, you authorize the app, it returns the callback URL with the token which returns to the app with the authVC showing. But I can't seem to get my authVC to hide.

Any advice would be greatly appreaciated.

Aucun commentaire:

Enregistrer un commentaire