title: How to query data form parse.com
body: <p>I am trying to get data from parse.com and validate is a record exists and if so perform a segue.</p>
  
  <p>This is my test code:</p>
  
  <pre><code>PFQuery *query = [PFQuery queryWithClassName:@"codes"];
  [query whereKey:@"code" equalTo:_code.text];
  
  [query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
      // comments now contains the comments for myPost
      if (comments) {
          NSLog(@"Success!");
      }else{
          NSLog(@"Fail!");
      }
  }];
  </code></pre>
  
  <p>Solution:</p>
  
  <pre><code>NSString *code1 = _code.text;
  NSNumber *code2 = [NSNumber numberWithInt:[code1 integerValue]];
  // Assume PFObject *myPost was previously created.
  PFQuery *query = [PFQuery queryWithClassName:@"present_codes"];
  [query whereKey:@"code" equalTo:@([code2 integerValue])];
  
  [query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
      // comments now contains the comments for myPost
      if (comments.count &gt; 0) {
          NSLog(@"Success!: %@", comments);
      }else{
          NSLog(@"Fail!: %@", comments);
      }
  }];
  </code></pre>