0

This is srsly driving me crazy.

I am trying to use getFirstObjectInBackgroundWithBlock() method in swift but I can't figure out how to (not) use the optionals ..

I just want to get the user's score from the parse server And I do it like this:

func updateScoreForCurrentUser(score: Int){
    let user = PFUser.currentUser()

    // get gameScore for user
    var query = PFQuery(className: "GameScore")
    query.whereKey("User", equalTo: user!)
    query.getFirstObjectInBackgroundWithBlock { (gameScore: PFObject, error: NSError?) -> Void in
        gameScore["score"] = score
}

I just get a "Cannot invoke 'getFirstObjectInBackgroundWithBlock' with an argument list of type '((PFObject?, NSError?) -> Void)'"

Can you pleaase help me? Thank you

4

1 に答える 1