解析查询在NSNumber堆栈中检索下一个对象

时间:2015-11-20 05:27:28

标签: ios xcode parse-platform nsnumber

我正在尝试从我的解析类中检索下一组解析数据,但我完全不知道如何实现我想要做的事情。

示例用户从提示#1开始,然后按下,然后显示提示#2,依此类推。

我在“下一步”按钮上有一个解析查询,它应该将解析中的下一个提示加载到名为tipBody的UILabel中,并将下一个连续提示号加载到我的tipNumber标签中。

enter image description here

- (IBAction)nextTipAction:(id)sender
{
    [ProgressHUD show:@"Loading Next Tip"];
    //Get Current Comments//

    __weak typeof (self) weakSelf = self;

    PFQuery *query = [PFQuery queryWithClassName:@"Archive"];
    [query whereKey:@"body" equalTo:@"tipNumber"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error)
        {

            weakSelf.tipNumberLabel.text =[NSString stringWithFormat:@"Tip Number: %ld", [[weakSelf.currentTip objectForKey:@"tipNumber"] integerValue]];
            [self.currentTip incrementKey:@"tipNumber" byAmount:@+1];
            [ProgressHUD dismiss];

        }
        else
        {
            [ProgressHUD dismiss];
            [ProgressHUD showError:@"Sorry! Unable to load Tips"];
            // Log details of the failure
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        }
    }];
}

非常感谢任何帮助!谢谢!

1 个答案:

答案 0 :(得分:0)

检查您的代码如下。

               String number;
                people.moveToFirst();
                do {

                    String name   = people.getString(indexName);
                     number = people.getString(indexNumber);
                 // for(int j=0;j<=j_count;j++){

                    if (some_num.contains(number)){
                        // do nothing
                    }
                    else{
                    Log.e("num",number);
                    //}
                    j_count++;


                    // Do work...
                } while (people.moveToNext());





                }