query.first对象始终未定义

时间:2015-07-14 01:32:57

标签: javascript object parse-platform

我有一个表名国家/地区,我键入一个国家/地区名称以查找哪一个对应,但我的日志显示{object,object}并继续呈现消息
"失败&#34 ;. 请给我一些建议。

- (void)viewWillAppear:(BOOL)animated
{
    NSLog(@"HERES postBackButtonPushed:%hhd", postBackButtonPushed);

    if(postBackButtonPushed == true)
    {
        self.view.hidden = YES;
        self.navigationController.navigationBar.hidden = YES;
        self.tabBarController.tabBar.hidden = YES;

        UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.delegate = self;
        [self presentViewController:imagePicker animated:NO completion:^{}];
    }

1 个答案:

答案 0 :(得分:0)

我知道这可能是旧的,但我刚刚遇到这个,只是检查对象是否返回== null ..所以你的代码在这里就是它的样子......

  var redeemnum = req.body.redeemnum;
  var country = Parse.Object.extend("country");  
  var query = new Parse.Query(country); 
  query.equalTo("name", redeemnum);
  query.first({  
   success: function(object) {
       if (object == null) {
           res.render("wrong", { msg : "Failed!" } );
       } else { 
            res.render("wrong", { msg : "Got it!" } );
       }
     }
  })