2

I want to update the telephone column and name column in the User Class with new values entered by user. I am using the same code recommended by Parse. Avoided changing anything except what is needed to try it out, but it is triggering an error. This is the error I get when I click to update the telephone and name of the user.

2015-12-08 20:55:26.044 Mawq[39532:1084556] [Error]: No results matched the query. (Code: 101, Version: 1.10.0) Optional(Error Domain=Parse Code=101 "No results matched the query." UserInfo={error=No results matched the query., NSLocalizedDescription=No results matched the query., code=101})

and this is the code in the function:

if(nameTextField.text != "" && telephoneTextField.text != "")
        {
            /*Update*/
            let query = PFQuery(className:"User")
            query.getObjectInBackgroundWithId(PFUser.currentUser()!.objectId!) {
                (gameScore: PFObject?, error: NSError?) -> Void in
                if error != nil {
                    print(error)
                } else if let gameScore = gameScore {
                    print("Telephone New: " + self.telephoneTextField.text!);
                    gameScore["telephone"] = self.telephoneTextField.text!
                    gameScore["name"] = self.nameTextField.text!
                    gameScore.saveInBackground()
                }
            }
        }

And the parse documentation is here: https://parse.com/docs/ios/guide#objects-updating-objects

6
  • What are you trying to do with the User column in Parse? Commented Dec 8, 2015 at 21:17
  • I want to update the telephone column and name column in the User Class with new values entered by user. Commented Dec 8, 2015 at 21:18
  • Have you tried this method: parse.com/docs/ios/guide#users-signing-up ? Commented Dec 8, 2015 at 21:28
  • @lukesIvi I used that for a signup function but it's not relevant here since am updating 2 columns not creating a new record Commented Dec 8, 2015 at 21:37
  • 1
    Why are you querying when you already have the user - just retrieve PFUser.currentUser(), update that object and then save it Commented Dec 8, 2015 at 21:46

1 Answer 1

2

The problem might be the fact that Parse uses the User className as "_User".

So try:

let query = PFQuery(className:"_User")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.