ios - Parse Login Using Swift -
i creating login page ios app using swift , parse. in initial view controller, have
var user = pfuser.currentuser() if user != nil { println(user) self.dismissviewcontrolleranimated(1, completion: nil) } else { println("no logged in user") var login: pfloginviewcontroller = pfloginviewcontroller() login.fields = pfloginfields.usernameandpassword | pfloginfields.loginbutton | pfloginfields.signupbutton self.presentviewcontroller(login, animated: true, completion: nil) }
in viewdidload method of viewcontroller want go after login. login screen shows up, , can type in information, if come in right login info doesn't go anywhere. point, restarting app allows me logged in. able log in without having restart app, not know how this.
you have implement
- (void)loginviewcontroller:(pfloginviewcontroller *)logincontroller didloginuser:(pfuser *)user { [self dismissviewcontrolleranimated:yes completion:null]; }
which called when pfuser logged in.
and in swift
func loginviewcontroller(logincontroller: pfloginviewcontroller!, didloginuser user: pfuser!) -> void{ self.dismissviewcontrolleranimated(true, completion: nil) }
ios login swift parse.com
No comments:
Post a Comment