It is very easy to read data from Parse database, just create a query using PFQuery class over class name (table name) and request for data.
For example - There is one table "Post" with column names : title, message, postTime. Now get data from table where title is "Today's Post"
Note: Post table also have predefined columns like- createdAt, updatedAt, objectId.
PFQuery *query = [PFQuery queryWithClassName:@"Post"];
// Above class name means table name
[query whereKey:@"title" equalTo:@"Today's Post"];
[query findObjectsInBackgroundWithBlock:^(NSArray *data, NSError *error){
// data is an aaray of all PFObjects that have title as "Today's Post"
}];
You can also get a single object like below.
PFQuery *query = [PFQuery queryWithClassName:@"Post"];
[query whereKey:@"title" equalTo:@"Today's Post"];
[query getFirstObjectInBackgroundWithBlock:^(PFObject *result, NSError *error){
// result object is the first object that has title as "Today's Post"
}];
0 Comment(s)