简体   繁体   中英

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.

http://i.stack.imgur.com/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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM