Chrisicut
Chrisicut

Reputation: 357

Parse & Swift- No results matched the query

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?

Upvotes: 1

Views: 1376

Answers (1)

pbush25
pbush25

Reputation: 5258

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.

Upvotes: 3

Related Questions