iOS Swift + Parse.com - user authentication best practices -
i love know if there best practices out there prevent me future frustration when comes user authentication parse.com in swift projects.
i have handful of views not function without logged in user. current methodology has been use viewwillappear redirect non-loggedin users login page simple as
override func viewwillappear(animated: bool) { if (pfuser.currentuser() == nil) { self.navigationcontroller?.poptorootviewcontrolleranimated(true) presentviewcontroller(alert, animated: true, completion: nil } else { // (...code...) }
but parse 209 error : invalid session token when somehow login user in ios simulator parse doesn't recognize user current user on server side. i'd love know if i'm following solid conventions or making weird workarounds causing externalities.
a few comments:
- your code looks good.
- there no reason check current user in every viewcontroller.
- you should not getting 209 error. take @ link: https://www.parse.com/docs/ios_guide#sessions-handleerror/ios handle 209 error
Comments
Post a Comment