1

I would love to know if there are some best practices out there to prevent me from future frustration when it comes to user authentication with Parse.com in Swift projects.

I have a handful of Views that would not function without a logged in user. My current methodology has been to use ViewWillAppear to redirect non-loggedin users to the login page with something as simple as

override func viewWillAppear(animated: Bool) {
    if (PFUser.currentUser() == nil) {   
         self.navigationController?.popToRootViewControllerAnimated(true)
         presentViewController(alert, animated: true, completion: nil
    } else {
        // (...code...)
}

but occasionally i get a parse 209 error : invalid session token when somehow i login a user in the iOS simulator but parse doesn't recognize that user as the current user on the server side. I'd love to know if I'm following solid conventions or just making up weird workarounds that are causing externalities.

1
  • The server request and error are unrelated to your view controller code. How are you contacting the server when you get the error? Commented May 11, 2015 at 22:00

1 Answer 1

3

A few comments:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.