解析findObjectsInBackgroundWithBlock有时会返回0值

时间:2016-07-13 15:55:02

标签: node.js swift parse-platform

我遇到了解析问题。我当前的问题是当我启动我的应用程序并尝试使用findObjectsInBackgroundWithBlock获取其返回0值的对象时。但在此之后我尝试使用findObjectsInBackgroundWithBlock获取其返回值的对象。

我该如何解决?

let query = PFQuery(className: "Classname")
            query.orderByDescending("updatedAt")
            query.whereKey("members", equalTo: PFUser.currentUser()!)
            query.findObjectsInBackgroundWithBlock { (groups, error) in
                if error == nil {
                    if groups?.count == 0 {
                        self.isEmpty = true
                        //self.tableView.hidden = true
                        self.emptyView.frame = CGRectMake(0, 130, self.view.frame.size.width, self.emptyView.frame.size.height)
                        self.emptyView.backgroundColor = UIColor(hex: "F5F9FC")
                        self.view.addSubview(self.emptyView)
                        self.emptyView.createNewGroupButton.addTarget(self, action: #selector(self.createNewGroup(_:)), forControlEvents: .TouchUpInside)
                    }else {
                        self.groups = groups!
                        self.isEmpty = false
                        self.emptyView.removeFromSuperview()
                    }

                    self.tableView.reloadData()
                }else {
                    print(error)
                }
}

0 个答案:

没有答案