I have the Parse SDK all set up and working for my practice app. The tutorial I was following had a log in and sign up using a UIAlertController
. I want to have a log in screen but I am new to iOS development.
I have a User
class in my Parse data and I want to connect a userNameTextField
and passWordTextField
to my LogInViewController
class with my StoryBoard. I also will have a loginButton
of type UIButton
on the bottom of those text fields.
This is my function in my LogInViewController
but the class will not show the methods of PFUser.
func login() {
PFUser.logInWithUserNameInBackground(userName.text, password: passWordLabel.text){
(user:PFUser!, error:NSError!)-> Void in
if((user) != nil){
println("Login Successful")
var installation:PFInstallation = PFInstallation.currentInstallation()
installation.addUniqueObject("Reload", forKey: "channels")
installation["user"] = PF.currentUser()
installation.saveInBackgroundWithTarget(nil, selector:nil)
}
else{
println("Login Failed")
}
}
I get this error PFUser.type does not have a member named loginuser with background
which is odd because my UIAlertController
in my app works fine when I used this method. I do not know if this should go my LoginViewController
or called within my apps main swift file.
I am a little lost if you understand what I am asking for have been through the same issues and respond thank you!
Have you queried to get the user details before logging in? Please check this link https://stackoverflow.com/a/18595207/3615320