Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need some help with this:

func checkUserCredentials() -> Bool{
      PFUser.logInWithUsername(userName!, password: Contrase?a!)
       if (PFUser.currentUser() != nil){
            return true
        }
        return false
   }

It says that PFUser.logInWithUsername(userName!, password: Contrase?a!) has problems because its not marked with try ... and the error is not handled.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
218 views
Welcome To Ask or Share your Answers For Others

1 Answer

func checkUserCredentials() -> Bool{
    do {
        try PFUser.logInWithUsername(userName!, password: Contrase?a!)
    } catch{
        // deal here with errors
    } 
    return PFUser.currentUser() != nil ? true : false
}

As it is quite basic issue I recommend you reading some tutorials


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...