Thursday, August 6, 2015

Query Data from a Parse Table

JAVA

ParseQuery<ParseObject> query = ParseQuery.getQuery("MyParseTable");

query.whereEqualTo("ID", "1");
query.findInBackground(new FindCallback<ParseObject>() {
    public void done(List<ParseObject> results, ParseException e) {
        if (e == null) {
            // You have all the results in the "results" variable.
        } else {
            // There was an exception. Check the "e" variable.
        }
    }
}


SWIFT

var query = PFQuery(className:"MyParseTable")

query.getObjectInBackgroundWithId("1") {
  (results: PFObject?, error: NSError?) -> Void in
  if error == nil && results!= nil {
    println(results)
  } else {
    println(error)
  }
}

No comments:

Post a Comment