Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Read/fetch data from Parse database in iOS app

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 180
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: