1

I seem to have a different problem than the previous askers.

I am trying to retrieve my object from Parse in Swift, I use this code

    var query = PFQuery(className:"GameScore")
query.getObjectInBackgroundWithId("mlwVJLH7pa") {
  (gameScore: PFObject?, error: NSError?) -> Void in
  if error == nil && gameScore != nil {
    println(gameScore)
  } else {
    println(error)
  }
}

Ignore the fact that I left GameScore the same...

Anyway's here is an image of my Parse data, to proof the objectId exists.

https://i.sstatic.net/XeFHH.jpg

This is the error I get in the console when running the simulator.

2015-07-21 11:10:39.496 ParseStarterProject[959:19643] [Error]: No results matched the query. (Code: 101, Version: 1.7.5)
Optional(Error Domain=Parse Code=101 "No results matched the query." UserInfo=0x7fdeaadb1200 {error=No results matched the query., NSLocalizedDescription=No results matched the query., code=101})

Why am I getting an error "No results matched the query" when the objectId does indeed exist?

5
  • Could it possibly be that you didn't change the name of the Class you were querying against? In your picture it looks like the class name is "Content" Commented Jul 21, 2015 at 19:00
  • Oh darn, I thought that was a variable for some reason... I'm very inexperienced with Swift as you can probably tell. Commented Jul 21, 2015 at 19:04
  • Yes, it is fixed. I apologize for my ignorance. Lol Commented Jul 21, 2015 at 19:05
  • Well it's a property on PFQuery and a very important one at that. Glad I could help, and don't apologize, we've all been there before! I'll set that as the asnwer and if you could accept it that would be great :) Commented Jul 21, 2015 at 19:05
  • A helpful hint: Check out Bolts to go along with Parse. It allows you to chain queries together which you might get to eventually. Good luck! Commented Jul 21, 2015 at 19:43

1 Answer 1

3

You have to make sure that the "className" property on PFQuery matches a class name that you have stored in Parse. In your case, it seems that it should be var query = PFQuery(className: "Content") based on the picture that you uploaded.

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.